I've been looking for and trying solutions for 2 days now. Can't seem to find anything that works.
Problem: Given a fillable PDF, I need to take data from a database and put it into the pdf, then allow the user to download it.
Context:
- The PDF is the same every time (So I can do manual manipulations to it initially if necessary to make it work)
- The PDF has checkboxes
- This needs to run in an alpine 3.16 docker container
- Using PHP 8.1
- Rebuilding the entire PDF with the data in it each time is not an option.
- I can't include the specific PDF here, but there's nothing special about it. Just a fillable pdf with text inputs and checkboxes.
Solutions I've Tried/Seen:
- Dompdf: Not for filling. Only creates
- Setasign/FPDI: Imports the template pdf, but doesn't have filling functionality
- SetaPDF-FormFiller: Probably works. Crazy expensive for what is a relatively small, but necessary, part of this app.
- tecnickcom/TCPDF: Not for filling. Only creates
- pdftk (Server): Testing this locally works. Unfortunately there doesn't seem to be a way to get it on an alpine container.
- pdftk-java: Haven't tested yet. Installing java on every pod just for this feature is a last-ish resort.
- mikehaertl/php-pdftk: PHP wrapper for pdftk. Same core problem of not being able to get it on alpine.
- FPDF: Doesn't support checkboxes
- codeshell/fpdm: Based on FPDF. Supports checkboxes, but it's broken as of PHP 8.1. Hasn't been updated in 4 years. Relevant issue
- Use an image: I could convert the PDF to an image, position text over the image at certain places, save the image, and convert back to pdf. This removes all "form" functionality from the pdf that gets downloaded, and ideally the user should still be able to edit the downloaded PDF.
Any help would be appreciated. As I mentioned, this is a small, but necessary part of the app, so I'm trying to find a solution that's proportionate.