Checked November 2026 against the official help pages linked below, and what Coffee does against its own code. Coffee isn't affiliated with Obsidian, Typora or iA Writer.
For a quick PDF, open the file in any app that shows Markdown as a formatted page, and use File, then Print, then Save as PDF. For control over margins, headers, page breaks and landscape pages, use Pandoc, or an editor whose PDF export has those settings. Markdown itself has no page settings, so everything below is set in the tool, not in the file.
What makes a PDF look good
It's a short list:
- Margins wide enough that lines of text aren't too long to read
- Headings that never sit alone at the bottom of a page
- Page numbers, once there's more than a page or two
- Tables and images that fit the page width
- No Markdown left showing, including front matter at the top of the file
Three ways to make the PDF
Print to PDF
Every Mac can save anything printable as a PDF: File, Print, then the PDF menu at the bottom of the dialog. It's free and takes seconds. What you get depends on how the app you printed from lays out a page, and you usually have little say in that.
Pandoc
Pandoc is free and scriptable, and it's what to use if you make the same kind of document often. The basic command is short:
pandoc notes.md -o notes.pdf That goes through LaTeX by default, so you need a LaTeX engine installed, and it looks like a LaTeX paper. To style it with CSS instead, go through HTML:
pandoc notes.md -t html --pdf-engine=weasyprint -o notes.pdf Its manual also lists Typst and others as engines. The results can be excellent, but expect an evening of setup the first time.
An editor with PDF export
Most Markdown editors can do this, and they differ in how much control you have.
| App | PDF options | Control over the look |
|---|---|---|
| Obsidian | Page size, margin preset, landscape, downscale. Desktop only | CSS snippets. Exports always use light styling |
| Typora | Paper size, margins, headers and footers with page numbers | Uses your theme, with custom CSS for print |
| iA Writer | Page size, title page, headers and footers with page numbers | Built-in templates, or your own in HTML, CSS and JavaScript |
| Coffee | A4 or Letter, title page, page numbers always on | Three templates, nothing to customise |
Obsidian's help page doesn't mention page numbers. Community plugins such as Better Export PDF add them.
If you want a look of your own, Typora and iA Writer let you build one and Coffee doesn't.
PDF export settings, one at a time
Margin settings
Margins are a setting of the tool, never of the Markdown. With Pandoc's LaTeX route, pass them as a variable:
pandoc notes.md -V geometry:margin=2cm -o notes.pdf Through HTML, set them in CSS with @page { margin: 2cm; }. Typora has a margin setting, and Obsidian has presets.
Coffee's margins come with the template and can't be changed: about 24 mm at the sides in Clean and Letterhead, and about 19 mm in Minimal.
Headers and footers
Pandoc's LaTeX route can load a LaTeX package for running headers through --include-in-header, which is LaTeX work rather than Markdown. Through HTML, CSS page margin boxes such as @bottom-center hold page numbers or a title, and WeasyPrint supports them. Typora and iA Writer have header and footer settings with page numbers.
Coffee's footer is the page number, on every page, centred in Clean and Letterhead and in the corner in Minimal. There's no running header. Letterhead puts your name from Settings and today's date at the top of the first page only.
Page breaks
Markdown has no page-break mark. Each tool has its own:
- Pandoc to LaTeX:
\newpageon a line of its own. - Anything that goes through HTML: an empty element styled with CSS, such as
<div class="page"></div>with.page { break-after: page; }in your stylesheet.
Coffee has neither, and HTML in a note prints as text, so don't add one there. Coffee starts a new page when one is full, and it keeps each heading with at least two lines of what follows it, which is the break most people are after.
Landscape pages
With Pandoc's LaTeX route, -V classoption=landscape turns the whole document. Through HTML, CSS can do it with @page { size: A4 landscape; }. Obsidian has a landscape switch.
Coffee's PDFs are portrait only. For a wide table, export to Word from the same menu and set the page to landscape there.
Paper size
Pandoc takes -V papersize=a4 or letter. Print to PDF uses the paper size chosen in the print dialog. Coffee offers A4 or Letter.
The document title
Pandoc takes the title from a title: line in the front matter. Many editors use the file name.
Coffee uses the note's file name, for the PDF's own title and for the title page if you turn one on. To change it, rename the note before you export.
A custom stylesheet
With Pandoc through HTML, pass your CSS with --css style.css. Typora uses your theme and takes extra CSS for print, Obsidian takes CSS snippets, and iA Writer has templates of your own.
Coffee doesn't take custom CSS or fonts. You choose one of three templates, and that's all the styling there is.
What formatting makes it into the PDF
This depends on the tool, so here's what to check, and what Coffee does.
Tables
Pipe tables work in Pandoc and nearly every editor. Wide ones are the problem: keep to about five columns on a portrait page, or turn the page.
In Coffee, tables print with a bold header row, and columns follow their alignment colons. All columns are the same width, and bold or links inside a cell print as their Markdown, so keep cells plain. There's more on writing them in the Markdown tables guide.
Images
Local images usually come through. Images on the web depend on the tool fetching them while it exports.
Coffee includes images stored with the note, scaled down to fit the page, and leaves out images on the web. See images in Markdown for keeping them with the note.
Code and syntax highlighting
Pandoc highlights fenced code blocks that name a language. Editors that print a styled preview usually keep its colours.
Coffee prints code blocks in a monospaced font on a grey band, without syntax colours. Inline code gets the same grey.
Footnotes
Pandoc supports [^1] footnotes. Plain CommonMark doesn't, so some editors print the brackets as they are.
Coffee prints each reference as a superscript number and moves the notes to the end of the document. More on the syntax in footnotes and task lists.
Equations and maths
Pandoc's LaTeX route handles $…$ maths as LaTeX does. Through HTML, maths needs a maths option, and results vary by engine.
Coffee draws $$ blocks and inline $…$ as formulas in the PDF. See maths in Markdown.
Diagrams, tasks and callouts
Mermaid code usually needs a plugin or a filter. Coffee draws Mermaid flowcharts, pie charts and sequence diagrams as charts, and prints task lists, quotes, callouts and highlights.
What gets left out
In Coffee, front matter is left out, and so are HTML comments, unless they're inside code. Links are coloured, but they aren't clickable in the PDF, so spell out any address the reader needs. Answers from the calculator print beside their lines, unless calculations are off.
When PDF export isn't working
The PDF export is blank
- The app printed too early. An app that prints a preview may not have finished drawing it. Wait until the preview shows, then print again.
- It printed the wrong pane. Some editors print the source when the cursor is in it. Print from the preview, or use the app's own export.
- There's nothing to print. A file that's only front matter or comments has no body. Coffee leaves both out, so such a note gives a page with nothing but its number.
- The note is locked. Coffee won't export or print a private note until you unlock it.
Formatting is lost in the PDF
Printing from a plain text editor, such as TextEdit, gives you the raw Markdown with every # and * showing. Print from an app that draws Markdown, or export instead of printing. If only some syntax is lost, it's probably an extension, such as footnotes or ==highlights==, that the tool doesn't read.
Images are missing
Check that the image paths are relative to the file and that the images are on the disk. An image on the web won't come through in Coffee, and may not elsewhere.
A table runs off the page
Cut columns, shorten headings, or turn the page to landscape in a tool that can.
Editing Markdown before you export
Markdown is plain text, so edit it in any app and export when it reads right. Coffee saves the note and exports it as it is at that moment, so there's no separate copy to keep in step. The two checks that help most: read the last page, as a line alone on a page is the most common flaw, and look at headings near the foot of each page.
In Coffee
Press ⌘E, choose a template, and export. There's no styling to do, and that's the whole idea. Pictures of all three templates are in the original article.
- Clean is the default, with centred page numbers.
- Letterhead puts your name from Settings and today's date above a thin rule on the first page.
- Minimal has narrower margins and moves the page number to the corner.
You can add a title page with the note's title, your name and the date. Coffee lays out the PDF itself rather than printing a web view, which is how it keeps headings with what follows them. File, then Print, uses the same layout with the Clean template. On iPhone and iPad, Coffee makes the PDF from its HTML export instead, on A4 pages with 2 cm margins and without the Mac's templates.
The limits, in one place:
- No custom fonts or CSS. If you need your company's typeface, this isn't the tool.
- Fixed margins, portrait pages, and no page-break mark.
- Images on the web are left out.
- Table columns are all the same width, and formatting inside cells isn't applied.
- Links aren't clickable in the PDF.
Coffee also exports Word, EPUB, HTML, Markdown and plain text.
Tips that work in any app
- Use one top-level heading. Start the document with a single
#, then use##for sections. Most tools build their layout from this. - Keep tables narrow. If a table has more than five or so columns, it's probably going to be cramped on a portrait page.
- Check images first. Make sure they're stored locally, and at a size that won't print blurry.
- Read the last page. A single line left on its own page is the most common flaw, and cutting a few words usually fixes it.
Questions
How do I add a page break in Markdown for a PDF?
Markdown has no page-break mark, so it depends on the tool. With Pandoc to LaTeX, put \newpage on a line of its own. In tools that go through HTML, use an empty element styled with break-after: page. Coffee has no page-break mark and breaks pages by itself, keeping headings with what follows.
How do I change the margins of a Markdown PDF?
In the tool, not the file. With Pandoc, add -V geometry:margin=2cm. Through HTML, use @page { margin: 2cm; } in CSS. Coffee's margins are fixed by its three templates, and Minimal has the narrowest.
Can a Markdown PDF have headers and footers?
Yes, if the tool has them. Typora and iA Writer have header and footer settings with page numbers, and CSS page margin boxes do it through HTML. Coffee puts a page number on every page, and its Letterhead template adds your name and the date to the first page.
Why is my Markdown PDF blank?
Usually the app printed before its preview was drawn, or printed the source pane, or the file has nothing outside front matter and comments. Wait for the preview, or export rather than print.
Can I export Markdown to PDF in landscape?
With Pandoc, add -V classoption=landscape. Through HTML, use @page { size: A4 landscape; }. Obsidian has a landscape switch. Coffee's PDFs are portrait only.
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
First published on the Coffee blog.