---
title: "Why your Markdown PDF export is blank, and how to fix it"
author: Pedro Thomaz
source: https://coffeetext.app/blog/why-is-my-markdown-pdf-blank
---

# Why your Markdown PDF export is blank, and how to fix it

> Checked 28 November 2026 against the [pandoc manual](https://pandoc.org/MANUAL.html) and Coffee's own help. I make Coffee, so weigh what I say about it. Coffee isn't affiliated with pandoc.

A Markdown PDF comes out blank, or with empty boxes where formulas and pictures should be, for one of five reasons: the page was printed before it finished drawing, the PDF engine was missing a font, a print stylesheet hid the text, the image paths pointed somewhere the converter couldn't see, or the note had nothing in its body to print. Each has a quick fix, and the right one depends on how your tool makes the PDF.

Most tools take one of two routes. Some turn the Markdown into a web page and print the page, which is what Print to PDF in an editor or a browser does. Others, like pandoc's default route, turn it into LaTeX and typeset that. The causes below are grouped by which route they belong to, so start with the one your tool uses.

## 1. The page was printed before it was drawn

Maths and diagrams in Markdown are usually drawn by JavaScript after the page loads. KaTeX or MathJax turns `$x^2$` into a formula, and Mermaid turns a code block into a diagram. If the PDF is made before those scripts finish, you get the raw TeX, an empty space, or a page that's white from top to bottom.

This happens most with tools that print a page in the background, such as an export command that opens a hidden browser, and with very long notes, where drawing takes longer.

**What to try:**

- Open the preview first and wait until every formula and diagram shows, then print or export.
- If your tool has a setting for a delay before printing, raise it.
- Split a very long note and export the parts, to see whether one diagram is stopping the rest.
- If one diagram has an error, the script may stop there. Fix that block and try again.

## 2. A missing font, or a character the engine can't set

On the LaTeX route, pandoc uses `pdflatex` unless you choose another engine. It handles plain Latin text well, but emoji, many accented and non-Latin characters, and symbols copied from the web can stop it with an error, so no PDF appears at all, or the characters are dropped and lines come out empty.

The usual fix is to choose an engine that uses the fonts on your Mac:

```
pandoc notes.md --pdf-engine=xelatex -V mainfont="Helvetica Neue" -o notes.pdf
```

`lualatex` works the same way. Pick a font that has the characters you use; an emoji needs a font with emoji in it, and many don't. The [pandoc manual](https://pandoc.org/MANUAL.html) lists the engines and the font settings.

On the web-page route, a missing font rarely blanks the page, but a web font that hasn't loaded can leave the text invisible for a moment, and a page printed in that moment is blank. Waiting for the preview, as in the first fix, solves that too.

## 3. A print stylesheet or a dark theme

Pages printed from an editor use its print styles. Two things go wrong:

- **A dark theme on white paper.** Some themes set white text and leave the paper white, so the PDF looks empty until you select the text in it. Switch to a light theme before printing, or use the tool's export instead of printing the editor.
- **CSS that hides things in print.** A rule inside `@media print` with `display: none` or `visibility: hidden`, often from a theme or a snippet you added, can hide the whole body. Turn custom CSS off and print again; if the PDF fills up, the CSS is the cause.

## 4. Pictures with paths the converter can't follow

A picture written as `![Map](images/map.png)` is found relative to where the converter is looking. Run pandoc from another folder, or export from a tool that copies the note somewhere else first, and the picture isn't found. Depending on the tool, you get an empty box, a missing picture, or an error that stops the PDF.

**What to try:**

- Run the converter from the note's own folder.
- With pandoc, pass `--resource-path` with the folder the pictures are in.
- Keep pictures in your notes folder rather than linking to the web. A picture on a website needs a connection at export time, and some tools leave web pictures out on purpose.
- Check the name exactly, capitals and spaces included. `Map.PNG` and `map.png` aren't always the same file to every tool.

There's more on paths in [pictures in Markdown on a Mac](https://coffeetext.app/blog/images-in-markdown-mac).

## 5. There's nothing in the body

A file that's only front matter, the block between two `---` lines at the top, has no body to print. The same goes for a note that's all HTML comments. Most tools leave both out of the PDF, so you get a blank page, or a page with nothing but its number.

Open the note in its plain Markdown view and check there's text below the front matter, and that a stray `---` hasn't turned your first paragraphs into front matter. [What front matter is](https://coffeetext.app/blog/what-is-front-matter) shows how the block should look.

## Other things that look like a blank PDF

- **The wrong pane printed.** Some editors print the source when the caret is in it, so the PDF is raw Markdown. Print from the preview, or use the export command.
- **A locked note.** Apps that encrypt notes, Coffee among them, won't export one until it's unlocked.
- **A viewer that hasn't loaded the file.** If Preview shows white pages, check the file size in Finder. A PDF of a few kilobytes really is empty; a large one may just need reopening.

## How Coffee exports a PDF

Coffee, the Markdown editor I make, avoids most of these causes by laying out the PDF itself instead of printing a web page. There's no browser to wait for and no print CSS. Formulas, Mermaid diagrams, callouts and footnotes are drawn natively, the same way they are in the note, and carried into the PDF as they look on screen. Coffee doesn't use pandoc or LaTeX, so there's nothing else to install and no engine to choose.

To make one:

1. Open the note and press ⌘E.
2. Pick a template and a page size, A4 or Letter.
3. Turn the title page on or off, then choose Export PDF.

Pictures are found relative to the note, and a path starting with `/` is read from the top of your notes folder, as in Obsidian. A note that's only front matter or comments still gives a page with just its number, because Coffee leaves both out. A private note has to be unlocked first.

The template sets the type, the margins, the header and the footer. [Markdown to PDF in Coffee](https://coffeetext.app/markdown-to-pdf) shows the templates side by side, [Coffee's help on exporting](https://coffeetext.app/help/export) lists every format, and [the templates directory](https://coffeetext.app/templates) has more layouts to add in one click. If you're also after running headers and page numbers, see [Markdown to PDF with headers, footers and page numbers](https://coffeetext.app/blog/markdown-to-pdf-headers-footers-mac).

## Questions

### Why is my Markdown PDF blank but the preview looks fine?

The PDF was probably made before the preview finished drawing, or a print stylesheet hid the text. Wait until every formula and diagram shows before exporting, and try a light theme with custom CSS turned off.

### Why are the formulas missing from my Markdown PDF?

Formulas are usually drawn by JavaScript, so a PDF made too early shows raw TeX or nothing. On pandoc's LaTeX route they're typeset by LaTeX itself, so a missing formula there is more likely an error in the TeX.

### Why does pandoc give no PDF at all?

Look at the error it prints. The most common is a character `pdflatex` can't set, such as an emoji. Try `--pdf-engine=xelatex` with a font that has the character.

### Why are pictures missing from my exported PDF?

Their paths are relative to a folder the converter isn't looking in, or they're on the web. Run the converter from the note's folder, use pandoc's `--resource-path`, or keep pictures beside your notes.

### Does Coffee need pandoc or LaTeX to make a PDF?

No. Coffee lays out the PDF itself on your Mac, with formulas and diagrams drawn natively, so there's nothing else to install.

---

Written by Pedro Thomaz, who makes Coffee, a Markdown editor for the Mac on macOS 15 or later, and for iPhone and iPad. It's free for 14 days with no card or account, then €3 a month, €29 a year, or €79 once with two years of updates. More at https://coffeetext.app/llms-full.txt
