Technology · Library

PDFlib — PDFs from data, to standard and in print quality

PDFlib is the library we reach for when a PDF export is no longer enough: for large volumes, exact typography, PDF/X print data, PDF/A archive files, accessible PDFs to PDF/UA and ZUGFeRD e-invoices. We have been working with it for more than 15 years, almost always from PHP, and run the applications on our own servers in Germany. Fields of use, the project process and operation are described in detail on our PDFlib development page.

In use for more than 15 years

What is PDFlib?

PDFlib is a developer library from PDFlib GmbH in Munich: an application describes text, graphics and images page by page, and PDFlib writes the PDF from that — on the server, without a layout program.

What PDFlib is and what it does

PDFlib has been on the market since 1997; its manufacturer, PDFlib GmbH in Munich, was a founding member of the PDF Association in 2006. The core is written in C and C++ and can be called from C, C++, Java, .NET, Objective-C, Perl, PHP, Python, RPG and Ruby, on Windows, macOS, Linux and Unix as well as IBM System i and IBM Z. It produces PDF 1.4 to 1.7 and PDF 2.0 — with Unicode, TrueType and OpenType fonts, text flow with hyphenation, tables across several pages, SVG and the common image formats. The current version is PDFlib 11.

The library comes in tiers. PDFlib creates PDFs from scratch. PDFlib+PDI also imports existing PDF pages and includes pCOS, which queries metadata, fonts or embedded files. The PDFlib Personalization Server (PPS) adds blocks that are set up in an Acrobat template and filled by the program. TET 6 works in the opposite direction and extracts text, images and metadata. In terms of standards, PDFlib covers PDF/A-1, -2 and -3, PDF/X-3, PDF/X-4, PDF/X-4p and PDF/X-5n, PDF/UA-1, PDF/VT-1 as well as ZUGFeRD, the German hybrid e-invoice format, and Factur-X.

How we work with PDFlib

With us, PDFlib almost always runs in PHP, loaded as an extension — in applications of our own based on Symfony or Laminas, in TYPO3 extensions and in Shopware plugins. Generation gets a module of its own: data in, PDF out. Where the layout changes more often than the logic, we work with PPS templates so that a design change does not mean a code change. Large runs go to the background and are logged, so that every document can be traced back to its record.

For us, a standard only counts as met once an independent validation tool confirms it; accessible PDFs are also tested with a screen reader. The applications run on our own servers in Germany, where PHP version, PDFlib extension, fonts and output profiles are maintained together — with maintenance under an SLA and with updates to new PDFlib versions that we first run against the same test data. The source code is yours, and the PDFlib licence is registered to your company.

Limits: when PDFlib is too much

PDFlib is licensed commercially, per machine and operating system, and it is a library, not a design tool: every layout is programmed or built as a template. For a manageable number of simple documents with no standard to meet, that is more than the task requires. In that case we use an open-source HTML-to-PDF solution — in the same PHP application, with the same tests and without PDFlib licence costs. If the requirements grow later, only the generation changes.

The second limit concerns expectations. PDFlib produces a document to PDF/UA-1, but the structure — headings, reading order, alternative text — has to come from the application. The same goes for ZUGFeRD: the library embeds the XML in a PDF/A-3 as the standard requires, while correct invoice data is your system’s job. Knowing this before the project means planning the data side from the start instead of delivering it at the end.

Frequently asked questions

What is the difference between PDFlib, PDFlib+PDI and PPS?

PDFlib creates PDFs from scratch. PDFlib+PDI can also import existing PDF pages — letterhead or forms, for example — and includes pCOS for querying information from PDFs. PPS builds on that and adds blocks for variable data, set up in a template with the Block Plugin for Acrobat. Which tier you need follows from your documents; we recommend the smallest one that does the job.

Which PDF standards does PDFlib support?

PDFlib generates PDF/A-1, -2 and -3 for archiving, PDF/X-3, PDF/X-4, PDF/X-4p and PDF/X-5n for prepress, PDF/UA-1 for accessible documents and PDF/VT-1 for variable print data. On top of that come ZUGFeRD 1.0, 2.0 and 2.1 and Factur-X for e-invoices, each as PDF/A-3 with embedded XML. Whether a generated document actually meets the standard is something we check with independent tools.

Does PDFlib also run in TYPO3 and Shopware?

Yes. In PHP, PDFlib is loaded as an extension and is therefore available to any PHP application, TYPO3 and Shopware 6 included. We build generation as a TYPO3 extension that typesets data sheets from records, for instance, or as a Shopware plugin that produces documents straight from the shop. It needs a server on which the extension matches the PHP version; with us, those are our own servers in Germany.

Do we need a PDFlib licence of our own?

Yes. PDFlib is licensed commercially, per machine and operating system; development and test systems are included, and manufacturer support can be added as an optional annual contract. You buy the licence from PDFlib GmbH in your company’s name — what belongs to you is in your name, just like the source code in your repository. Before buying, the fully functional evaluation version lets us build a sample document from real data.

PDFlib: existing system or new build?

We also take over systems that were built elsewhere — after a look at the code and the hosting.

What else we build with

Call Start a project