At the moment there are quite a few softwares (mostly paid) that allow you to manipulate PDF files as they are sold online. Some even allow you to add identifying customer data to the PDF in order to copyright, encrypt and password intellectual property. Currently the WordPress plugin scene includes three main routes for PDF manipulation.
Risking simplifying things to a degree and possibly excluding outliers on the market, most products for WordPress will use these library set #4:
- Option 1: TCPDF (using TCPDI to parse)
- Option 2: TCPDF (using FPDI to parse)
- Option 3: FPDF (using TCPDI to parse)
- Option 4: FPDF (using FPDI to parse)
- Option 5: TCPDF (using FPDI PDF-Parser from Setasign)
- Option 6: FPDF (using FPDI PDF-Parser from Setasign)
- Option 7: SetaPDF Stamper (a Setasign product)
Watermarkers using FPDI/FPDF (Option 4) include WooCommerce PDF Watermark from WooCommerce, the Ignite WooCommerce PDF Watermark Stamper, and Tips & Tricks’ WP PDF Stamper. Basically, all the competition uses the same library set. Some competitors have tried to incorporate Options 5/6/7 into their GPL plugins, but this violates the license of Setasign and usually fails for that reason.
The only watermarker/PDF stamper currently using all the options (any of your choice) is PDF Ink. We accomplish this by bundling the GPL-compatible licenses, and makign it easy for you to add a Setasign library later if you choose to purchase one.
Because there are constant questions about the differences between the options, and what they can and cannot do, we will try to clarify the options.
Option 1: TCPDI/TCPDF
This library set performs as well as the free version of FPDI/FPDF, if not better, because it allows for manipulations of all versions of PDF, not just older versions. It also includes UTF-8 support, HTML, and imports PDF annotations.
On the other hand, development of the only stable versions of TCPDI has stalled. We have made a few tweaks to help parse newer PDF files and some outlier cases, but there is no hope for any pull request going through.
We switched to TCPDF several years ago after finding FPDI/FPDF essentially incompatible with what we were trying to offer users and customers. No regrets, except when it comes to its shortcomings. It’s free, though, so we get what we pay for. These PDF manipulation libraries tend to lose advanced PDF features such as internal links, layers, forms, and struggle with linearized (“fast web view”) PDFs. It’s best to move to Option 5/6/7 if you have valuable, complex PDFs and need fidelity.
Option 4: FPDI/FPDF
The free version of FPDI doesn’t watermark newer PDFs. It only works with PDFs version 1.4 or older. That’s a major deal. This is a major limitation of watermarkers using Option 4 (basically, all our competition).
The benefits of using FPDI/FPDF is that the code is regularly maintained. Other than that, FPDI also has the same limitation as TCPDI: neither can read PDF recursive objects into memory which have to do with complex PDF features such as internal links (Table of Contents [TOC] for example) or PDF forms.
Please note if a WordPress plugin claims to preserve a PDF’s integrity including internal links and you are not required to purchase a library from Setasign, they have probably bundled non-GPL software. The plugin authors are violating GPL and the FPDI author’s license as well. Two words: not cool.
In this way, neither Option 1 nor Option 4 are favorable for someone serious about the integrity of their PDFs. Option 5/6/7 might cost more money, but it’s just worth it.
Option 7: SetaPDF-Stamper
From the same company that created FPDI comes a code library called SetaPDF-Stamper. This library allows you to manipulate PDFs similarly to Option 1 or Option 4; however, it uses an entirely different method which rather than re-writing a PDF from memory, simply adds to the PDF. Many more (malformed, newer, linearized, incremented) PDFs will pass muster while using SetaPDF-Stamper, and PDFs will retain their original state: forms, layers, TOCs, etc. will all be left alone.
Again, we consider this the best, smartest option. Anyone who can afford to purchase and implement this library should choose it. A lot of headache can be avoided: timeouts while parsing PDFs into memory using (TCPDI/FPDI), PDF-parsing failures, and PDF feature loss (to name a few huge headaches).
PDF Ink is fully compatible with SetaPDF-Stamper, whether you are using WordPress or not. If you are not using WordPress, the PDF Ink methods can be called using a couple dozen lines of code, many of which are cut-and-paste. In this way stamping can be inlined into your PHP application.
To make the choice a little easier, the purchase PDF Ink includes a 20% off coupon for Seta-PDF Stamper.
I hope this helps you make more sense of the plugin market and make decisions. Thanks for reading!