danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!
https://danfickle.github.io/pdf-templates/index.html
Other
1.91k stars 356 forks source link

PDF as Background / Layering #944

Open wolfomat opened 1 year ago

wolfomat commented 1 year ago

Hi there,

is it possible, to use a pdf as background (layer) and use another as foreground?

greetings,

rototor commented 9 months ago

There is a sample for that. See https://github.com/danfickle/openhtmltopdf/blob/open-dev-v1/openhtmltopdf-examples/src/main/resources/freemarker/featuredocumentation.ftl

You have to register the StandardObjectDrawerFactory for this to work. See also here https://github.com/danfickle/openhtmltopdf/blob/open-dev-v1/openhtmltopdf-examples/src/main/java/com/openhtmltopdf/freemarker/FreeMarkerGenerator.java