Skip to main content

06 - PDF Generation Research

Standard Screenplay Format

Page Dimensions

  • US Letter: 8.5" x 11" (215.9mm x 279.4mm)
  • A4 also acceptable for international markets

Margins (English/LTR)

  • Left: 1.5" (for binding with brads)
  • Right: 1.0"
  • Top: 1.0"
  • Bottom: 0.5" - 1.0"

Margins (Arabic/RTL — Mirrored)

  • Right: 1.5" (binding side — Arabic books/scripts bind on right)
  • Left: 1.0"
  • Top: 1.0"
  • Bottom: 0.5" - 1.0"

Element Positioning (English)

ElementLeft MarginRight MarginAlignment
Scene Heading1.5"1.0"Left
Action1.5"1.0"Left, justified
Character Name3.7"1.0"Left (appears centered)
Parenthetical3.1"2.0"Left
Dialogue2.5"2.5"Left
Transition1.5"1.0"Right

Element Positioning (Arabic — Mirrored)

ElementRight MarginLeft MarginAlignment
Scene Heading1.5"1.0"Right
Action1.5"1.0"Right, justified
Character Name3.7"1.0"Right (appears centered)
Parenthetical3.1"2.0"Right
Dialogue2.5"2.5"Right
Transition1.5"1.0"Left

Font

  • English standard: Courier 12pt (monospaced)
  • Arabic: No standard exists. Recommendations below.

Spacing

  • Scene heading: preceded by 2 blank lines (first scene after title page: 0)
  • Between elements: 1 blank line
  • Dialogue after character: 0 blank lines
  • Parenthetical: 0 blank lines
  • Page numbers: top right (English) or top left (Arabic), starting from page 2

Formatting

ElementEnglishArabic
Scene HeadingUPPERCASE, bold or underlineBold, underline
Character NameUPPERCASEBold
TransitionUPPERCASEBold
ActionNormalNormal
DialogueNormalNormal
ParentheticalNormal, in parensNormal, in parens

Node.js PDF Libraries

Why: Purpose-built for RTL content, drop-in replacement for pdfmake.

Features:

  • Automatic RTL detection — no manual configuration
  • Smart table column reversal
  • Unicode script detection
  • Automatic font selection for different scripts
  • Proper text alignment for RTL
  • List bullet positioning for RTL
  • Mixed content support (LTR + RTL in same document)
  • 100% pdfmake API compatible

Usage:

import pdfMake from '@digicole/pdfmake-rtl';

const docDefinition = {
content: [
{ text: 'داخلي. مقهى - نهار', style: 'sceneHeading' },
{ text: 'فهد يجلس وحيداً', style: 'action' },
],
defaultStyle: {
font: 'Cairo',
alignment: 'right',
},
styles: {
sceneHeading: { bold: true, decoration: 'underline' },
action: {
/* default */
},
},
};

pdfmake (base)

jsPDF

PDFKit

  • NO RTL support — not suitable for Arabic

pdf-lib

  • Create/modify PDFs with JavaScript
  • No RTL support — not suitable

Arabic Fonts for PDF

Cairo (Google Fonts)

Noto Naskh Arabic (Google Fonts)

Scheherazade New (SIL)

  • Style: Calligraphic naskh
  • Good for: Title pages, decorative text
  • License: SIL Open Font License

Amiri (Google Fonts)

IBM Plex Arabic (Google Fonts)

Font Embedding Strategy

  1. Fonts NOT committed to git (binary files, downloaded at build time)
  2. Build script downloads from Google Fonts API
  3. Embedded in PDF for consistent rendering
  4. User can configure font in CLI: hekaya export --font cairo

The Monospaced Problem

English screenplays use Courier 12pt. The monospaced font ensures:

  • ~55 lines per page
  • ~1 minute of screen time per page

Arabic has no standard monospaced screenplay font. Options:

  1. Use proportional font (Cairo/Noto) with calibrated font size
  2. Document that page count ≈ screen time ratio differs
  3. Provide a "timing calibration" option in the CLI

Flutter PDF (Phase 2)

pdf package (dart)

  • Pure Dart PDF generation
  • Recent RTL improvements
  • Arabic font support via TTF embedding
  • npm equivalent of pdfmake

Syncfusion Flutter PDF

  • Enterprise-grade
  • PdfTextDirection.rightToLeft explicit support
  • Tested with Arabic, Hebrew, Persian, Urdu
  • TrueType font embedding

Recommendation for Flutter Phase

Use Syncfusion Flutter PDF for best RTL results. The pdf package is improving but Syncfusion has more mature Arabic support.

References