Reputation: 1215
I'm using FPDF/FPDI to take a PDF template and fill it out with data from a database. It works fine except for one thing. The PDF template has form fields that are to be filled out by the end user. The problem is that the PDF template is flattened by FPDF/FPDI so that the user can no longer fill out the text fields. I'd like to preserve the text fields in the outputted PDF but I'm not sure how.
Here's the relevant code:
include('fpdf.php'); // library for PDF generation
include('fpdi.php'); // library for using FPDF with PDF templates
$pdf =& new FPDI('L','pt', 'Letter');
$inputPDF = 'files/templates/test.pdf';
$pdf->setSourceFile($inputPDF);
...
$pdf->AddPage();
$tplidx = $pdf->ImportPage(1);
$pdf->useTemplate($tplidx);
$outputPDF='files/test.pdf';
$pdf->Output($outputPDF, 'F');
Upvotes: 0
Views: 997
Reputation: 5058
This is not possible with FPDI as describe in this FAQ item. If you need to pre-fill a PDF form you may try the SetaPDF-FormFiller component (not free!).
Upvotes: 1