mikehaertl / php-pdftk

A PDF conversion and form utility based on pdftk
MIT License
952 stars 128 forks source link

Showing hidden fields #310

Closed Centridox closed 1 year ago

Centridox commented 1 year ago

Hi,

the issue was closed, but some additional information. The PDF holds some javascript that either hides or shows fields, based on checking or unchecking a box. That is quit common practice in a form. As the checking is not done while the form is active, the script is not run. So, the question is, is there a way to show hidden fields via php-pdftk? In that manner, I could easily show the fields myself. MyForm.pdf

Regards, Peter

mikehaertl commented 1 year ago

Our library is just a wrapper around pdftk: It prepares the form data in XML and then feeds it into pdftk which does the heavy lifting.

So your issue is definitely nothing we can fix here. You could try to report your issue to pdftk-java. I'd try to create an easy to reproduce example. You could use our helper class to prepare a proper XFDF file (see https://github.com/mikehaertl/php-pdftk/blob/master/tests/XfdfFileTest.php) and then use pdftk fill_form to fill out your form (see man page for pdftk).

But to be honest I'm unsure if it's fixable within pdftk at all. I think they don't execute any js at all and it also doesn't know anything about "hidden fields" (at least I think so). This is rather something that happens in the reader when the PDF is opened. I could be wrong though, so maybe worth a try.