Combining XFA with PDFBox

后端 未结 5 1661
面向向阳花
面向向阳花 2020-12-14 14:09

I would like to fill a PDF form with the PDFBox java library. The PDF form is created with Adobe Live Designer, so it uses the XFA format.

I try to find resources ab

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-14 14:27

    Try this and it will merge all pdf with no xfa and with XFA(this is when using PDBox only)

    
    PDAcroForm form = document.getDocumentCatalog().getAcroForm();
     if(form != null) {
          document.setAllSecurityToBeRemoved(true);
          form.flatten();
          if(form.hasXFA()) {
             form.setXFA(null);
          }
     }                       
     merge.appendDocument(anyPDFDoc, document);
    

提交回复
热议问题