From 601e5119e79fd4f00fe0f2bc5ae4438e7574a9f6 Mon Sep 17 00:00:00 2001 From: Martin Vilcans Date: Thu, 9 Oct 2014 09:42:03 +0200 Subject: Add page break support in PDF output --- screenplain/export/pdf.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/screenplain/export/pdf.py b/screenplain/export/pdf.py index b43d801..62653d5 100644 --- a/screenplain/export/pdf.py +++ b/screenplain/export/pdf.py @@ -3,13 +3,20 @@ # http://www.opensource.org/licenses/mit-license.php from reportlab.lib import pagesizes -from reportlab.platypus import BaseDocTemplate, Paragraph, Frame, PageTemplate +from reportlab.platypus import ( + BaseDocTemplate, + Paragraph, + Frame, + PageTemplate, +) +from reportlab import platypus from reportlab.lib.units import inch from reportlab.lib.styles import ParagraphStyle from screenplain.types import ( Action, Dialog, DualDialog, Transition, Slug ) +from screenplain import types lines_per_page = 55 characters_per_line = 61 @@ -130,8 +137,8 @@ def to_pdf(screenplay, output_filename, template_constructor=DocTemplate): add_paragraph(story, para, slug_style) elif isinstance(para, Transition): add_paragraph(story, para, transition_style) - #elif isinstance(para, PageBreak): - # TODO: page break + elif isinstance(para, types.PageBreak): + story.append(platypus.PageBreak()) else: # Ignore unknown types pass -- cgit