from reportlab.lib.pagesizes import A4 from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak, KeepTogether from reportlab.lib import colors from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.lib.enums import TA_CENTER from reportlab.lib.units import mm from reportlab.pdfbase.ttfonts import TTFont from reportlab.pdfbase import pdfmetrics import os out = "/mnt/data/Flyberria_Riaan_Printable_Cue_Cards.pdf" styles = getSampleStyleSheet() title = ParagraphStyle("MainTitle", parent=styles["Title"], fontName="Helvetica-Bold", fontSize=23, leading=27, alignment=TA_CENTER, spaceAfter=3) subtitle = ParagraphStyle("Sub", parent=styles["Normal"], fontName="Helvetica", fontSize=10, leading=13, alignment=TA_CENTER, spaceAfter=12) scene = ParagraphStyle("Scene", parent=styles["Heading2"], fontName="Helvetica-Bold", fontSize=15, leading=18, spaceBefore=2, spaceAfter=7) cue = ParagraphStyle("Cue", parent=styles["Heading3"], fontName="Helvetica-Bold", fontSize=10, leading=12, spaceBefore=5, spaceAfter=3) body = ParagraphStyle("Body2", parent=styles["BodyText"], fontName="Helvetica", fontSize=9.5, leading=13, spaceAfter=4) line = ParagraphStyle("Line", parent=styles["BodyText"], fontName="Helvetica-Bold", fontSize=12, leading=16, leftIndent=8, spaceBefore=2, spaceAfter=6) small = ParagraphStyle("Small", parent=styles["BodyText"], fontName="Helvetica-Oblique", fontSize=8.5, leading=11, textColor=colors.HexColor("#444444"), spaceAfter=4) story = [ Paragraph("FLYBERRIA", title), Paragraph("RIAAN'S PRINTABLE CUE CARDS | CHARACTER: BLOB", subtitle), Paragraph("How to use: Wait for the cue in each box, then say your line. Actions are included in order.", body), ] def add_scene(name): story.append(Spacer(1, 4)) story.append(Paragraph(name, scene)) def add_cue(n, wait, say=None, action=None): parts = [Paragraph(f"CUE {n}", cue)] if wait: parts.append(Paragraph(f"WAIT FOR: {wait}", body)) if say: if isinstance(say, str): say = [say] for s in say: parts.append(Paragraph(f"“{s}”", line)) if action: parts.append(Paragraph(f"YOUR ACTION: {action}", body)) parts.append(Spacer(1, 4)) story.append(KeepTogether(parts)) add_scene("SCENE 1 – THE BEGINNING OF CHAOS") add_cue(1, "Freezer smashes through the brick wall. Bloob says, “Whoa! Chill! What's your problem?!”", action="Watch the flashback. You have no spoken lines in this scene.") add_scene("SCENE 2 – THE REVENGE") add_cue(2, "Freezer says, “You want to fight?!”", "But Cooler was attacked by the Strawberry years ago!") add_cue(3, "Bloob says, “Please, you have to understand—” Freezer refuses