enigma969
enigma969

Reputation: 427

PDF Form Field Contents not displayed

I generate PDFs with form fields programmatically using Apache PDFBox (Java). However, when loading the PDF with PDF.JS/Firefox, the content of those fields is not displayed. When opening the files with a standalone viewer or Chrome, the content of that fields is displayed correctly.

I know that PDF.JS doesn't support editing AcroForms, but I read that just displaying shouldn't be any problem.

Here is a generated PDF that isn't displayed correctly with PDF.JS/Firefox:

https://drive.google.com/file/d/0B197M5cYPdP4U2hhV1U2UURpSE0/view?usp=sharing

Upvotes: 2

Views: 2143

Answers (1)

enigma969
enigma969

Reputation: 427

Solution was to set the flag "NeedAppearances" to false as mkl and Maruan Sahyoun mentioned in the comments. Thanks.

PDDocumentCatalog docCatalog = _pdfDocument.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
acroForm.setNeedAppearances(false);

Upvotes: 3

Related Questions