- First you'll need to install PrinceXML:
$ brew tap caius/prince
$ brew install prince
yarn start
to spin up the server- edit
src/example.mdx
output.pdf
gets generated on save
This example is using Tailwind. Format pages in PDF, add pagination, control page spreads, margins, background, etc. in src/pdf-styles.css
with Prince's Paged Media CSS rules.
This code will display page counter on bottom of every page and add start a new page on every H1 encounter.
/* src/pdf-styles.css */
@page {
size: A4;
@bottom {
content: counter(page);
}
}
h1 {
break-before: page;
}