While there are quite a few PDF-handling software libraries out there, there are only a handful of pertinent, quality ones built on PHP. Several of those are included in PDF Ink.
Keep in mind the software libraries used by PDF Ink are written and maintained by outside (3rd party) developers. PDF Ink is yet another piece of software which knits all these libraries together — and connects them to WordPress and WordPress e-commerce plugins.
In order to Ink PDFs, we’ll need a reader and a writer.
PDF Reader
If we were just going to be creating a PDF, such as an invoice, all we would need is a PDF writer. However, since we plan on taking an existing PDF and modifying it, we need a reader. The PDF reader will parse the PDF data (bytes) into memory, doing its best to understand the syntax it encounters. If you are curious about what that syntax looks like, just open any PDF with a plain text editing application like TextEdit, BBEdit, or NotePad. Looking under the hood can help one appreciate the mountain of work these PDF Readers — and the people who write/maintain them — perform!
Free (open-source) PDF readers included in PDF Ink are TCPDI and FPDI. For better PDF reading, upgrade to FPDI PDF-Parser or for even better handling, upgrade SetaPDF Stamper.
TCPDI is not a well-maintained library anymore, however it handles some things which FPDI does not, namely PDF versions 1.4 and newer, and UTF-8. FPDI PDF-Parser is the paid/premium version of FPDI, essentially, and allows for handling of all PDF versions; it is also well-supported and maintained.
SetaPDF Stamper can manipulate PHP files with much less memory-overhead than the other libraries, and maintains PDF fidelity. This is the recommended option for any organization serious about their PDF content, file safety, and their server health.
There are choices to be made, but often it just comes down to which library pair handles your PDFs well. If one library does not work, try another. We have yet to have encountered a case where SetaPDF Stamper did not work.
PDF Writer
Once a PDF is read into PHP memory, it can be manipulated. Once you know a bit about how this is handled, and are realistic about the “Wild West” nature of PDF creation/access in the wild, you’ll be pretty realistic about how “secure” a PDF can be made. As even NASA knows, nothing is safe in this world. However, there are things that can be done to thwart bad players, and those do include watermarking, encryption and passwording. And that is what a PDF writer can do.
Free (open-source) PDF writers included in PDF Ink are TCPDF and FPDF. For best handling, upgrade to SetaPDF Stamper.
Each writer has slightly different settings block in PDF Ink administration pages, but for the most part they offer similar writing options: fonts, color, size, transparency, rotation. FPDF does not have HTML, TCPDF includes quite a bit of HTML, SetaPDF Stamper has some HTML. SetaPDF Stamper does not yet have watermarking with images, but that is road-mapped (Jan 2025).
Our Recommendation
Our recommendation will always be to upgrade to SetaPDF Stamper. If you are anticipating spending less to protect your intellectual property(!), use FPDI PDF-Parser. If you want to spend even less money and take advantage of free libraries, you might get spotty results… at a good price, or you might get lucky. Quite a few people get lucky.
Start with the free libraries, and if those don’t work, either attempt to repair your PDFs or upgrade to a better library pair.
We support and maintain PDF Ink. We do not support or maintain ANY of these 3rd party PDF reading/writing libraries, so using a library you have paid for guarantees you are fully supported.
Here’s some incentive: the purchase of PDF Ink comes with a discount code toward SetaPDF Stamper. We work with the team at SetaSign and have for many years. They’re excellent people with a stellar product.
Further information
Which PDF Manipulation Library to Use? (2020 blog post)