In this post, we look at how to compile a markdown-formatted resume into a clean, print-ready PDF using Pandoc inside a container.
When hosting a resume on a personal website, it is often desirable to offer both an interactive HTML page and a downloadable PDF version. However, generating a high-quality PDF version of a resume can be tricky. Using a browser’s “Print to PDF” feature can result in unwanted website menus, footers, or layout artifacts.
Instead, we can use Pandoc, the universal document converter, to render the clean Markdown source document into a standard, print-ready document PDF. By running Pandoc inside a Docker container, we avoid having to install Pandoc, LaTeX, or other heavy typesetting engines on our local host machine.
Here is the exact setup and workflow.
The Conversion Command
We can copy the master Markdown resume into our workspace and run the official pandoc/extra Docker image. Since we want to use a clean, simple font like Roboto, we can mount our Windows host font directory into the container and use the xelatex PDF engine.
Run the following command in a PowerShell terminal:
docker run --rm `
-v "${PWD}:/data" `
-v "C:\Windows\Fonts:/usr/share/fonts/truetype/windows" `
pandoc/extra:latest `
resume.md `
--pdf-engine=xelatex `
-V geometry:margin=0.5in `
-V mainfont="Roboto" `
-o static/resume.pdf
How it Works:
-v "${PWD}:/data": Mounts your current working directory to the container’s/datadirectory (using PowerShell’s${PWD}automatic variable).-v "C:\Windows\Fonts:/usr/share/fonts/truetype/windows": Mounts the Windows system fonts directory into the container’s font path, giving the container access to Roboto.pandoc/extra:latest: The official, lightweight image containing Pandoc and the XeLaTeX typesetting engine.--pdf-engine=xelatex: Tells Pandoc to use the XeLaTeX engine instead of standard pdflatex, allowing us to load system TrueType/OpenType fonts.-V geometry:margin=0.5in: Passes themargin=0.5inparameter to LaTeX’sgeometrypackage, shrinking page margins by 75% for a professional resume format.-V mainfont="Roboto": Instructs XeLaTeX to use Roboto as the primary document font.resume.md -o static/resume.pdf: Tells Pandoc to take the source Markdown fileresume.mdand compile it into a standard document PDF atstatic/resume.pdf.
By adding this command to your local script or deployment pipeline, you can ensure that your downloadable PDF resume is always synchronized with your latest Markdown source edits!