BFO PDF Library 2.26.4 and Report Generator 1.2.6

BFO PDF Library 2.26.4

BFO Report Generator 1.2.6

A quick note to announce we've put out two new releases, the PDF Library and Report Generator. We missed the announcement for the last PDF Library so we'll summarize that here too.

Graphics2D interface

We are occasionally asked if we have a Graphics2D interface to draw to the page (or canvas), The answer for most of the last ten years has been not quite.

The sticking point was always fonts - the java.awt.Font class can't be subclassed. (Specifically, deep in the AWT a particular object is cast to a sun-specific implemention of an interface, which means we can't make our own subclass).

However, as part of our recent work on PDF/A conversion we now have code to build a completely new OpenType font, from scratch. This solves this problem, as we can convert any AWT font to a new OpenType font for use with PDF without needing to subclass.

So we can finally offer a complete Graphics2D interface onto our PDFCanvas and PDFPage objects. Both of these classes now have a createGraphics() method to access this interface - see the Javadoc for the terms and conditions. Note that it is not a complete replacement for the existing methods for drawing to the page, but will be useful for integration into an existing system based on the AWT rendering model.

Printing regression fixed

We broke something in 2.26 which is only obvious when you print some PDF using the Java print layer - images would occasionally be mis-sized or mis-positioned. That's now fixed.

Resource merging improvements

If you're using the Merge Resources functionality to reduce the size of stitched-together PDF documents by reconciling duplicate fonts, images and so on, this release has a few improvements. The files we generate now properly update the ToUnicode for any merged fonts, making text-extraction more reliable and removing a few warnings when the PDF is reloaded by our API. And in a few cases fonts weren't being merged when they could be - that's now fixed.

Many small tweaks and fixes

We've had a particular client thrashing the PDF/A side of the API for the last few months with tens of thousands of files, so many of the fixes are very particular fixes for specific files and testcases to do with PDF/A validation. We're not going to itemise them; there are many, see the changelog. It's another step in our efforts to ensure the library works better with damaged files: recover what we can, fail with a useful message when we can't

Native code! And other JVMs

Don't panic - the API is still 100% Java. But we've been playing with the native code compilation from the GraalVM project, and have put some changes into the API as a result.

This GraalVM sub-project allows Java applications to compile to native code; we ship an API, so it's not something of direct benefit to us. But any application built with our API should now compile to native code - we've found and removed various assumptions in the API that don't hold true when compiling to native.

(Our one sentence assessment of this process, by the way, is that it has a huge benefit in terms of startup time, but application speed seems unchanged).

Lastly we've done some testing with the Liberica JDK, which is a complete JVM but a fraction of the size of the OpenJDK release, so better suited for deployment in Docker images. It passes all our PDF related tests with results identical to OpenJDK, including the bitmap-based tests which have historically shown a lot of variation between JVM vendors. So we're happy to recommended the Liberica Java 17 JVM for anyone using deploying to Docker, or who just wants to trim a little fat from their deployment.

New Report Generator

We've bought our Report Generator up to the current release as part of this refresh, but there's no functional changes to speak of other than the barwidth property is now supported for EAN-13, UPC-A and EAN-8 barcodes when it wasn't before. The underlying PDF API has been updated, but most of the changes are not in the codepath used by the Report Generator so there's very little of significance here.


This is a clean and polish release - stability improvements and bug fixes galore, but little major new functionality over 2.26.2. As always, you can download the latest version and upgrade any time.