When producing a PDF, it might be desirable to include a watermark, visible on all pages. In Prince it is easy to do so with CSS.
In order to repeat it on all pages, the watermark needs to be placed in a
@page
at-rule.
We shall place it in the page region @prince-overlay
(see
Page regions) and create the watermark with generated
content (see Generated content in page regions):
@page {
@prince-overlay {
color: rgba(0,0,0,0.8);
content: "Watermark";
font-size: 20pt;
}
}
This style snippet can be saved into a watermark.css
file, which
will be called when generating the document:
prince --style=watermark.css myfile.html -o myfile_with_watermark.pdf