zendframework / zf1

This project reached its end-of-life on 2016-09-28. Contains conversion of ZF1 subversion repo to git, from version 15234 forward, and only containing master and release-1.12 branches and 1.12 tags.
https://framework.zend.com/blog/2016-06-28-zf1-eol.html
BSD 3-Clause "New" or "Revised" License
357 stars 800 forks source link

Zend_Pdf setTextField not working correctly in Safari or Preview #644

Open spikeyfish2 opened 8 years ago

spikeyfish2 commented 8 years ago

I have created a PDF (version 1.4) with form fields, and I am updating them using:

$pdf->setTextField('name', 'Test User');

Once I render this (either using pdf $pdf->render() or pdf $pdf->save('file.pdf')) and viewing it in either Safari or Preview on mac, as well as Safari on iOS, the values haven't updated, apart from the fact that I can see them when clicking on the field itself. However, on Adobe Acrobat or Google Chrome they display correctly.

spikeyfish2 commented 8 years ago

Tested the same PDF with Apache's PDFBox and everything works correctly with all viewers. I've had to resort to using a Java program to generate the PDF's via PHP, but would prefer an all-PHP solution if this could be fixed.

froschdesign commented 8 years ago

@spikeyfish2 At the moment, I see no chance to fix the problem. Zend_Pdf and ZendPdf are out of support.

Maybe @adeelnawaz or @stephenorr can help.

adeelnawaz commented 8 years ago

Hey @spikeyfish2, have you tried setting a text field in Adobe Acrobat and then viewing it in Safari or previewing it on Mac? If that works fine then the problem's with Zend_Pdf. Otherwise its general PDF issue with Mac.

froschdesign commented 8 years ago

@adeelnawaz Thank you very much!

spikeyfish2 commented 8 years ago

Thanks @froschdesign and @adeelnawaz,

I've tested with a new PDF document created with Adobe Acrobat, and the filled in form appears correctly in Preview and Safari. I've also moved to a Java solution for now (Apache's PDFBox) which also works as expected, so I think this is an isolated issue with Zend_Pdf.

After some more investigation, it (somewhat) works correctly in Safari and Preview when no value is already specified. For example, if the form is already partially filled out with values, and the values are updated again in Zend, the values do not display correctly. But if the form is completely blank, and the values are filled in with Zend, it works correctly - although there is a graphical issue in that the text does not sit fully inside the form field, so gets clipped at the top.

I appreciate your help as I know this is now out of support.