A pdf stylesheet example

Most obsidian themes neglect styling native PDF exports, and for good reason: Obsidian does not expose the generated HTML that will become the exported PDF document. Any styling work is done by feeling around in the dark. That is until the excellent Print Preview plugin by @NothingIsLost.

Using the Print Preview plugin and taking guidance from CSS: The Perfect Print Stylesheet by Andreas Hecht, I have created a custom PDF stylesheet for my purposes.

If any of you want to follow the gist, I’ll keep it updated, but it really is set to my preferences and designed to work best with my custom version of the Minimal Theme by @kepano.

The fact is, if you want a good PDF stylesheet, it really needs to be customized to your theme of choice.

Some of you may be able to use my stylesheet (install it as a CSS snippet) but my hope is that theme designers will see what can be done and take an interest in including PDF styling with their beautiful themes.

The effort can be small. This took me about 2 hours to get it just right.

I’ve attached a zip file that contains an example note and its exported PDF with my stylesheet applied.

Test Note.zip (113.3 KB)

PDF export stylesheet for obsidian (github.com)


I see from this perhaps the most critical settings to be decisions on where to prohibit page breaks. One could copy just those blocks alone to a CSS and likely gain significantly in quality when doing an md to printed PDF conversion.



1 Like