CFDocument, Flying Saucer, and Background-Images

I’m trying to upgrade to the latest CFDocument PDF extension ( and I cannot get background-image: url() to work for the life of me. I just wanted to know if they are supported and I’m doing something wrong? Or, if they are simply not supported in the version of Flying Saucer that we are using?

1 Like

These are the available artefacts in flying saucer pdf library used in Lucee:

org.xhtmlrenderer:flying-saucer-pdf - PDF output using iText 2.x
org.xhtmlrenderer:flying-saucer-pdf-itext5 - PDF output using iText 5.x
org.xhtmlrenderer:flying-saucer-pdf-openpdf - PDF output using OpenPDF

The manifest for the PDF tags:

Manifest-Version: 1.0
Export-Package: org.lucee.extension.pdf.tag
Bundle-ManifestVersion: 2
Require-Bundle: bouncycastle.mail;bundle-version=1.38.0,

Which suggests we’re operating on the bare minimum iText 2.x lib for rendering. This might provide some clues as to what might be possible with the current implementation.

We had to move from the old rendering engine for licensing reasons. And i suspect not a lot of thought has been given to how we might leverage the newer library beyond legal compliance at this time.

It’s one of those annoying things that could probably be improved dramatically if we had the capital to more readily direct resources.

I totally get it. PDFs aren’t “sexy” :smiley: Frankly, I’ve barely worked with them in the last few years until just recently. And that’s only because I’m excited at the idea of trying to take a PDF and make it more interesting.

Seems OpenHtmlToPDF may have recently fixed this bug

Yet another good reason for Lucee to switch over from flying saucer


I know it’s not reccomended to use cfexecute but if your server run under linux wkhtmltopdf solved all my problems with PDF generation.
Here you are with useful commons options:

<cfexecute name="/usr/local/bin/wkhtmltopdf" arguments="--dpi 300 --disable-smart-shrinking --page-size A4 --orientation Portrait --images --background --margin-bottom 10mm --margin-left 10mm --margin-right 10mm --margin-top 10mm #htmlfilein# #pdffileout#" timeout="30"></cfexecute>


1 Like

Good timing – I actually just started playing around wkhtmltopdf over the weekend :smiley:

I have ended up using this wrapper for hkhtmltopdf for PDF generation and have found it to work very well, solving most of our PDF rendering issues.

1 Like

Second that, used it for years, never looked back or around for other PDF-tooling.