Simple PDF Generation Guide - ScrumGuides/ScrumGuide-ExpansionPack GitHub Wiki
This guide explains the minimal approach to generating PDFs from Markdown files using only Pandoc and frontmatter -Configuration-Reference.
Prerequisites
Before you can generate PDFs, ensure you have the following installed:
Required Software
-
PowerShell 7+ - Required for running the automation script
- Windows: Install PowerShell 7+
- macOS: Install PowerShell on macOS
- Linux: Install PowerShell on Linux
- Verify installation:
pwsh --version
-
Pandoc - Document converter
- Download Pandoc
- Required for converting Markdown to PDF
- Verify installation:
pandoc --version
-
LaTeX Distribution - PDF rendering engine
Quick Installation Commands
PowerShell 7+
Windows:
# Using Windows Package Manager (winget)
winget install Microsoft.PowerShell
# Using Chocolatey
choco install powershell-core
macOS:
# Using Homebrew
brew install powershell
Linux (Ubuntu/Debian):
# Download and install latest version
curl -sSL https://aka.ms/install-powershell.sh | sudo bash
Overview
The PDF generation process has been simplified to use:
- YAML frontmatter in Markdown files for all -Configuration-Reference
- Simple Pandoc command with minimal arguments
- Cover page injection using
--include-before-body
Files Structure
scripts/
├── Create-GuidePDFs.ps1 # PowerShell script for PDF generation
├── cover-page.tex # LaTeX cover page template
└── simple-template.tex # Minimal LaTeX template (optional)
site/content/guide/
├── index.md # English version
├── index.fa.md # Farsi version
└── index.tlh.md # Klingon version
Markdown Frontmatter
Each Markdown file must include the following frontmatter for PDF generation:
English (LTR languages)
---
title: Your Document Title
description: Document description for cover page
lang: en
dir: ltr
mainfont: "Times New Roman"
sansfont: "Arial"
monofont: "Courier New"
pdf-engine: xelatex
creator:
- Author Name 1
- Author Name 2
---
Farsi/Arabic (RTL languages)
---
title: عنوان سند شما
description: توضیحات سند برای صفحه جلد
lang: fa
dir: rtl
mainfont: "BNazanin"
sansfont: "BNazanin"
monofont: "BNazanin"
pdf-engine: xelatex
creator:
- نام نویسنده اول
- نام نویسنده دوم
---
Key Frontmatter Parameters
lang
: Language code (e.g.,en
,fa
,tlh
)dir
: Text direction (ltr
orrtl
)mainfont
: Main font for the documentsansfont
: Sans-serif fontmonofont
: Monospace fontpdf-engine
: Usexelatex
for Unicode support
Manual Pandoc Command
You can generate PDFs manually using this simple command:
pandoc input.md -o output.pdf --include-before-body=cover-page.tex
Example Commands
# English version
pandoc index.md -o scrum-guide-expansion-pack.en.pdf --include-before-body=cover-page.tex
# Farsi version
pandoc index.fa.md -o scrum-guide-expansion-pack.fa.pdf --include-before-body=cover-page.tex
# Klingon version
pandoc index.tlh.md -o scrum-guide-expansion-pack.tlh.pdf --include-before-body=cover-page.tex
Using the PowerShell Script
📋 Prerequisites: Ensure PowerShell 7+ is installed before running the script.
The Create-GuidePDFs.ps1
script automates the process:
# Generate all PDFs
.\scripts\Create-GuidePDFs.ps1
# Force regeneration
.\scripts\Create-GuidePDFs.ps1 -Force
# Generate specific language
.\scripts\Create-GuidePDFs.ps1 -Language fa
How It Works
- Pandoc reads frontmatter automatically - All -Configuration-Reference comes from the YAML header
- Cover page injection - The
--include-before-body
argument adds the cover page - Font handling - XeLaTeX engine handles Unicode and custom fonts
- No external variables - Everything is self-contained in the Markdown files
Font Requirements
Ensure the following fonts are installed on your system:
For English/Latin scripts:
- Times New Roman (mainfont)
- Arial (sansfont)
- Courier New (monofont)
For Farsi/Arabic scripts:
- BNazanin or similar Arabic/Farsi font
- Alternative: Tahoma, Arial Unicode MS
For other scripts:
- Install appropriate Unicode fonts for your target language
-Troubleshooting-Guide
Common Issues
-
"Font not found" errors
- Install the required fonts on your system
- Check font names with
fc-list
on Linux/macOS - Use fallback fonts like "DejaVu Sans" if needed
-
XeLaTeX not found
- Install TeX Live, MiKTeX, or MacTeX
- Ensure XeLaTeX is in your PATH
-
Character encoding issues
- Ensure Markdown files are saved as UTF-8
- Use XeLaTeX engine (specified in frontmatter)
Testing Font Availability
# On Linux/macOS
fc-list | grep -i "font-name"
# On Windows (PowerShell)
Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts' | Select-Object PSChildName
Benefits of This Approach
- Simplicity - No complex script logic
- Self-documenting - All -Configuration-Reference is in the source files
- Maintainable - Easy to understand and modify
- Portable - Works with standard Pandoc installation
- Version control friendly - -Configuration-Reference travels with content
Migration from Complex Scripts
If you previously used complex PowerShell scripts:
- Move -Configuration-Reference from script variables to frontmatter
- Remove font detection logic - specify fonts directly
- Remove YAML parsing - let Pandoc handle it
- Simplify error handling - rely on Pandoc's built-in checks
Advanced Usage
For more complex documents, you can still use additional Pandoc options:
# With custom template
pandoc input.md -o output.pdf --template=simple-template.tex --include-before-body=cover-page.tex
# With additional filters
pandoc input.md -o output.pdf --include-before-body=cover-page.tex --filter pandoc-citeproc
# With variables
pandoc input.md -o output.pdf --include-before-body=cover-page.tex -V geometry:margin=2cm
But remember: the goal is simplicity. Only add complexity when necessary.