diff options
author | Andrew Benson <abenson@gmail.com> | 2019-04-26 03:15:00 +0200 |
---|---|---|
committer | Andrew Benson <abenson@gmail.com> | 2022-01-02 23:18:26 -0600 |
commit | 7ddd8af531a4bb335758122b06fae42ed7b603a9 (patch) | |
tree | 3c3b863ed7f556a82387942dc80d9acfb6bebc91 | |
parent | ef32edb276e2b2d542bb7c731547a153220d98aa (diff) | |
download | screenplain-7ddd8af531a4bb335758122b06fae42ed7b603a9.tar.gz |
export/pdf: make sure title page is centered.
Closes #50.
-rw-r--r-- | screenplain/export/pdf.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/screenplain/export/pdf.py b/screenplain/export/pdf.py index 6955616..ccc7cf1 100644 --- a/screenplain/export/pdf.py +++ b/screenplain/export/pdf.py @@ -17,6 +17,7 @@ from reportlab.platypus import ( Paragraph, Frame, PageTemplate, + NextPageTemplate, Spacer, ) from reportlab import platypus @@ -43,6 +44,7 @@ right_margin = page_width - left_margin - frame_width top_margin = 1 * inch bottom_margin = page_height - top_margin - frame_height +title_frame_width = page_width - left_margin - left_margin default_style = ParagraphStyle( 'default', @@ -118,7 +120,13 @@ class DocTemplate(BaseDocTemplate): id='normal', leftPadding=0, topPadding=0, rightPadding=0, bottomPadding=0 ) + title_frame = Frame( + left_margin, bottom_margin, title_frame_width, frame_height, + id='title', + leftPadding=0, topPadding=0, rightPadding=0, bottomPadding=0 + ) pageTemplates = [ + PageTemplate(id='title', frames=[title_frame]), PageTemplate(id='standard', frames=[frame]) ] BaseDocTemplate.__init__( @@ -237,6 +245,8 @@ def get_title_page_story(screenplay): story.append(Spacer(frame_width, middle_space)) story += lower_story + story.append(NextPageTemplate('standard')) + story.append(platypus.PageBreak()) return story |