XfaForm { public static void setXfaForm(XfaForm form, PdfDocument pdfDocument) throws IOException { PdfAcroForm acroForm = PdfAcroForm.getAcroForm(pdfDocument, true); setXfaForm(form, acroForm); } XfaForm();  XfaForm(InputStream inputStream);  XfaForm(Document domDocument);  XfaForm(PdfDictionary acroFormDictionary);  XfaForm(PdfDocument pdfDocument); static void setXfaForm(XfaForm form, PdfDocument pdfDocument); static void setXfaForm(XfaForm form, PdfAcroForm acroForm); static Map<String, Node> extractXFANodes(Document domDocument); void write(PdfDocument document); void write(PdfAcroForm acroForm); void setXfaFieldValue(String name, String value); String getXfaFieldValue(String name); boolean isXfaPresent(); String findFieldName(String name); String findDatasetsName(String name); Node findDatasetsNode(String name); static String getNodeText(Node n); void setNodeText(Node n, String text); Document getDomDocument(); void setDomDocument(org.w3c.dom.Document domDocument); Node getDatasetsNode(); void fillXfaForm(File file); void fillXfaForm(File file, boolean readOnly); void fillXfaForm(InputStream is); void fillXfaForm(InputStream is, boolean readOnly); void fillXfaForm(InputSource is); void fillXfaForm(InputSource is, boolean readOnly); void fillXfaForm(Node node); void fillXfaForm(Node node, boolean readOnly); static final String XFA_DATA_SCHEMA; }
@Test public void createEmptyXFAFormTest01() throws IOException, InterruptedException { String outFileName = destinationFolder + "createEmptyXFAFormTest01.pdf"; String cmpFileName = sourceFolder + "cmp_createEmptyXFAFormTest01.pdf"; PdfDocument doc = new PdfDocument(new PdfWriter(outFileName)); XfaForm xfa = new XfaForm(doc); XfaForm.setXfaForm(xfa, doc); doc.addNewPage(); doc.close(); Assert.assertNull(new CompareTool().compareByContent(outFileName, cmpFileName, destinationFolder, "diff")); }
@Test public void createEmptyXFAFormTest02() throws IOException, InterruptedException { String outFileName = destinationFolder + "createEmptyXFAFormTest02.pdf"; String cmpFileName = sourceFolder + "cmp_createEmptyXFAFormTest02.pdf"; PdfDocument doc = new PdfDocument(new PdfWriter(outFileName)); XfaForm xfa = new XfaForm(); XfaForm.setXfaForm(xfa, doc); doc.addNewPage(); doc.close(); Assert.assertNull(new CompareTool().compareByContent(outFileName, cmpFileName, destinationFolder, "diff")); }