Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TcpdiDriver with PDF field #66

Open
alexis-riot opened this issue Dec 8, 2021 · 7 comments
Open

TcpdiDriver with PDF field #66

alexis-riot opened this issue Dec 8, 2021 · 7 comments

Comments

@alexis-riot
Copy link

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 and lastname 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.

@alexis-riot
Copy link
Author

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();
}

@kaystrobach
Copy link
Collaborator

please create a MR and possibly a testcase, i will take a look into it then

@alexis-riot
Copy link
Author

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.

@kaystrobach
Copy link
Collaborator

kaystrobach commented Dec 8, 2021

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 - ?

@alexis-riot
Copy link
Author

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.

@alexis-riot
Copy link
Author

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.

@alexis-riot
Copy link
Author

@kaystrobach Hello, any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants