Editable .pdf fields disappear (but visible on field focus) after save with evince

前端 未结 2 710
余生分开走
余生分开走 2020-12-19 16:23

First off, let me thank the SO community for helping me so many times in the past; you guys are an amazing resource!

At my job I work on a web application that uses

2条回答
  •  既然无缘
    2020-12-19 16:52

    I have accepted mkl's answer as it hits the nail on the head regarding why the fields do not display properly, and contains much more information than I can provide regarding the issue. However, the suggested fix in the answer's comments did not work because the documents are generated (in this particular case) using iText 2.1.5's PdfCopyFields, which does not respect (strips) the original document's NeedAppearances flag, and calling setNeedAppearances(true) for AcroForm did not solve the issue because of this.

    Hacking the createAcroForms() method in PdfCopyFieldsImp to include the line

    form.put(PdfName.NEEDAPPEARANCES, PdfBoolean.PDFTRUE);
    

    is what ultimately seems to have solved the issue for me. With this addition, evince properly displays changes to fields after saving and reopening the document.

提交回复
热议问题