Alex Watt

About Blog Hacks Recommendations

Making a Booklet

Recently I was compiling a booklet of devotions for a mission trip. My goal was to make a simple booklet using standard paper, printed double-sided, and folded down the middle. I looked online for options and kept finding web-based tools that looked like overkill. I wanted a simple text booklet - no splashy template, no color, no images.

I had heard of Pandoc and PDFJam before and decided to give them a try. The tools worked really well for my use case. I thought I’d share what worked for me as it took me a bit to figure out, not having any prior experience with these tools.

Tools

Step 1: Process Markdown files

I had nine days of devotions and rather than store them in one large Markdown file, I wanted to put each in its own Markdown file. Originally I received them as nine Word documents. Perhaps I could have used Pandoc to process the Word documents themselves but I also liked the idea of representing each devotion in Markdown. I love plain text formats.

I wrote a small Python script to process these files; for instance, I wanted to add the LaTeX \newpage command before each devotional, except the first one; and I had a few other small transformations I wanted to do.

This Python script generated a single Markdown file from the other nine, and I could feed this into the next step.

Step 2: Convert Markdown to PDF

The second step was the conversion of the single Markdown file into a PDF. Here is the command I used:

pandoc config.yaml build/intermediate.md -o build/intermediate.pdf --pdf-engine=xelatex

And here is my config.yaml file:

---
title: Team Devotions
author: Name of Author
documentclass: book
classoption: 14pt
header-includes:
  - \usepackage{extsizes}
  - \usepackage{geometry}
  - \geometry{a5paper, margin=0.8in}
  - \usepackage{fancyhdr}
  - \pagestyle{fancy}
  - \fancyhf{}
  - \fancyhead[C]{Team Devotions}
  - \fancyfoot[C]{\thepage}
  - \renewcommand{\headrulewidth}{0pt}
---

There are several things in here that took me a while to learn, including:

Step 3: Creating a Booklet PDF

At the end of step 2, I had a nicely formatted PDF that I could share with my team and would be great for digital viewing, but I hadn’t figured out how to print it as a booklet.

Ultimately, I used PDFjam with a command like this:

pdfjam --booklet true --landscape --suffix booklet --paper letterpaper --outfile build/booklet.pdf build/intermediate.pdf

The resulting PDF was ready to print double-sided to create my booklet. PDFJam took care of combining every two pages of the intermediate PDF into a single page of the final PDF, and it also correctly laid out the pages so that the front and back of the booklet were on one side of a single page, etc.

Note: I’ve since learned that sometimes you can generate the booklet through your print dialog, but it was still appealing to me to have a PDF of letter-size paper that represented the booklet.

Reflection

I was really happy with the final output from this project! The booklet looked clean and professional. I also enjoyed learning some new tools that I expect will be useful again in the future. I also hope this write-up helps someone else create a booklet!

Posted on 29 Jan 2024.