Closed mdonagh closed 2 years ago
I have looked at it but can't reproduce the problem (I ran into a bug while trying various things that will be fixed with the next release, though).
I tried the following script:
require 'hexapdf'
doc = HexaPDF::Document.open('/tmp/example.pdf')
doc.acro_form.flatten(create_appearances: false)
doc.write('/tmp/flattened.pdf')
The resulting file shows the form fields when inspecting visually:
I also tried modifying a field inserting this line before flattening:
doc.acro_form.field_by_name("ADDRESS 1").field_value = "Some Address Here 1"
This also works:
Could you provide a short example script where this problem appears? Thank you!
@mdonagh I just tried this again to make sure it still doesn't work for me with the latest code and, alas, I still can't reproduce the problem. Could you provide a sample script?
@mdonagh Since you haven't responded and I can't reproduce the problem, I will close the issue. If this is still a problem, please let me know and I will re-open the issue.
example.pdf See example PDF here - this has the fields populated, I cannot figure out how to get them to flatten.
I've been able to get the fields populated with the below:
However, when I flatten the PDF fields with the below, they are all empty.
Also, when I flatten the fields this way rather than our legacy method,
strings = PDF::Inspector::Text.analyze(pdf).strings
cannot read the strings. Why is that?Legacy method below:
Your help would be greatly appreciated here @gettalong Thomas, thanks in advance