Open alexis-riot opened 2 years ago
https://www.setasign.com/products/setapdf-merger/demos/assistant-demo/#p-300 This example should work for merging 2 PDF and conserve fields states.
In the code, we can see:
// merge all files
$document = $merger->merge();
// if form fields were merged, set a flag that introduce the
// reader application to re-render the form field appearances.
$acroForm = $document->getCatalog()->getAcroForm();
$fields = $acroForm->getFieldsArray();
if ($fields !== false && count($fields) > 0) {
$acroForm->setNeedAppearances();
}
please create a MR and possibly a testcase, i will take a look into it then
please create a MR and possibly a testcase, i will take a look into it then
MR with what content ? I have no solution on your library for fix this problem about form fields.
isn't that these 4 loc?
$acroForm = $document->getCatalog()->getAcroForm();
$fields = $acroForm->getFieldsArray();
if ($fields !== false && count($fields) > 0) {
$acroForm->setNeedAppearances();
}
Seemed to me, that it's enough to put it in the end of the merge function - ?
isn't that these 4 loc?
$acroForm = $document->getCatalog()->getAcroForm(); $fields = $acroForm->getFieldsArray(); if ($fields !== false && count($fields) > 0) { $acroForm->setNeedAppearances(); }
Seemed to me, that it's enough to put it in the end of the merge function - ?
I have take this code from SetaPDF-Merger. And your library is using TCPDI/FPDI Driver.
isn't that these 4 loc?
$acroForm = $document->getCatalog()->getAcroForm(); $fields = $acroForm->getFieldsArray(); if ($fields !== false && count($fields) > 0) { $acroForm->setNeedAppearances(); }
Seemed to me, that it's enough to put it in the end of the merge function - ?
Because in your example, how you get $document
?
On the example of SetaPDF, the document is returned by the merge()
method. But in the case of your library, the merge method return the raw PDF merged and not the document.
@kaystrobach Hello, any news?
Hello,
I have a fillable PDF, when I save it with some fields filled, TCPDI Driver can't display they fields. You can simply reproduce this with the following PDF: example.pdf
firstname
andlastname
is filled (Toto / Rico). But if you pass it through TCPDI Driver (or FPDI), these data is not displayed.Do you know how can I use TCPDI Driver with fillable PDF?
Thanks you.