api: Form fill fails with forms produced with Adobe Acrobat
aaigr11 opened this issue · comments
Thank you for submitting a possible bug!
Please ensure the following:
- Your issue is based on the latest commit - YES
- State your OS and OS version - Windows Server 2012 R2 64 bit (also tested on Windows 10 54 bit)
- When reporting a problem with a specific PDF input file please avoid stating the organization responsible for the PDFWriter - just refer to the PDFWriter
I am experienced Golang developer; I am trying to fill PDF form using pdfcpu APIs - cannot make any of them work if PDF is created with the latest Adobe Acrobat. I tried all versions - from 1.4 to 1.7. All forms are failing with validation errors, and if I switch validation to relaxed, the file is produced but cannot be opened with Adobe Reader or Chrome.
Is there a known issue with Adobe Acrobat compatibility?
Thank you in advance!
Hi!
Understood!
Can you provide a little test file then I can provide a fix.
File is attached - created with Adobe Acrobat, latest version 2024.002.20687.
Created from scratch. Has only 2 tx fields: firstname, lastname.
PDFCPU fails with error: dict=type1FontDict required entry=FirstChar missing.
The following config used:
conf := new(model.Configuration)
conf.NeedAppearances = true
conf.Reader15 = true
conf.ValidationMode = model.ValidationStrict
If I switch to a relaxed validation, the error doesn't happen, but the created filled PDF is created corrupted and cannot be opened by any PDF reader (neither by Acrobat Reader, not by Chrome/Edge reades).
attached is corrupted file created with relaxed validation:
conf := new(model.Configuration)
conf.NeedAppearances = true
conf.Reader15 = true
conf.ValidationMode = model.ValidationRelaxed
no problem filling your PDF using the CLI.
As far as API:
pdfcpu is providing appearance streams and stick with ValidationRelaxed.
In general you should be fine by just doing conf := api.LoadConfiguration()
It works with just:
conf := api.LoadConfiguration()
Thank you very much!!