Writing DocRaptor Compatible CSS - Paperight/website GitHub Wiki

Automated HTML-PDF document conversion on www.paperight.com/server uses DocRaptor to process and convert documents to PDF. The appearance of the output PDF is controlled with CSS. We use a standard style sheet for Paperight editions of books (you can find it on GitHub), but you may need to create a personalized style sheet for specific projects.

There are two resources for doing this:

  1. DocRaptor Documentation: This is the documentation for using the DocRaptor API, and includes some styling information.
  2. Prince XML user guide: DocRaptor is built using Prince XML, so the Prince CSS reference is incredibly useful – especially considering they have many built-in functions for elements like page numbering and footnotes.

For margins (space for watermarking):

@page { size: A4; margin: 40pt 25pt 20pt 30pt; }

For page numbering:

@page front { margin: 0; }

@page main { @bottom { content: counter(page) } }

front { margin: 0; padding: 0; page: front; }

.pagenum { float: right; color: grey; }

For footnotes:

@page { @footnotes { border-top: solid black thin; padding-top: 8pt; margin: 12pt } }

.fn { float: footnote; counter-increment: footnote; font-size: 87%; }

.fn::footnote-call { content: counter (footnote); font-size: 83%; vertical-align: super; line-height: none; }