This project combines multiple Markdown (.md) files into a single PDF using Pandoc and WeasyPrint.
-
Install Python 3 https://www.python.org/downloads
-
Install Pandoc https://pandoc.org/installing.html
-
Install WeasyPrint Open PowerShell and run: pip install weasyprint
-
(Windows only) Install GTK Runtime WeasyPrint requires the GTK runtime to render PDFs on Windows. Download and install from: https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer
pset2025/ ├─ cover.md ├─ problem1.md ├─ problem2.md ├─ ... ├─ problem8.md ├─ style.css └─ custom_logo_photoshop_6_hrs.png
Each .md file should end with:
Run this command from inside the folder in PowerShell (adjust pdf engine path to your weasyprint install):
pandoc (Get-ChildItem -Filter *.md | Sort-Object Name | ForEach-Object { $_.Name }) `
-o pset2025.pdf `
--from markdown+raw_html `
--pdf-engine="C:\Users\flash\AppData\Roaming\Python\Python313\Scripts\weasyprint.exe" `
-c style.cssIf WeasyPrint is added to your PATH, you can simplify it to:
pandoc (Get-ChildItem -Filter *.md | Sort-Object Name | ForEach-Object { $_.Name }) -o pset2025.pdf --from markdown+raw_html --pdf-engine=weasyprint -c style.css- Margins and font styling are controlled in style.css
- To adjust margins, edit the "margin" value in style.css
- Code blocks should use fenced syntax (triple backticks)
- Make sure all image paths are relative to the folder
If you get an error about missing DLLs or Pango, reinstall the GTK runtime. If Pandoc cannot find WeasyPrint, add this folder to your PATH: C:\Users<YourUser>\AppData\Roaming\Python\Python313\Scripts
Output: pset2025.pdf