Exemplo n.º 1
0
        public virtual void FindFieldNameWithoutDataSet()
        {
            String      inFileName  = sourceFolder + "TextField1_empty.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfReader(inFileName));
            PdfAcroForm acroForm    = PdfAcroForm.GetAcroForm(pdfDocument, true);
            XfaForm     xfaForm     = acroForm.GetXfaForm();
            String      name        = xfaForm.FindFieldName("TextField1");

            NUnit.Framework.Assert.IsNull(name);
        }
Exemplo n.º 2
0
        public virtual void ExtractXFADataTest()
        {
            String      src         = sourceFolder + "xfaFormWithDataSet.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfReader(src));
            XfaForm     xfa         = new XfaForm(pdfDocument);
            XElement    node        = (XElement)xfa.FindDatasetsNode("Number1");

            NUnit.Framework.Assert.IsNotNull(node);
            NUnit.Framework.Assert.AreEqual("Number1", node.Name.LocalName);
        }
Exemplo n.º 3
0
        public virtual void FindFieldName()
        {
            String      inFileName  = sourceFolder + "TextField1.pdf";
            PdfDocument pdfDocument = new PdfDocument(new PdfReader(inFileName));
            PdfAcroForm acroForm    = PdfAcroForm.GetAcroForm(pdfDocument, true);
            XfaForm     xfaForm     = acroForm.GetXfaForm();

            xfaForm.FindFieldName("TextField1");
            String secondRun = xfaForm.FindFieldName("TextField1");

            NUnit.Framework.Assert.IsNotNull(secondRun);
        }
Exemplo n.º 4
0
        public virtual void CreateXFAFormTest()
        {
            String      outFileName = destinationFolder + "createXFAFormTest.pdf";
            String      cmpFileName = sourceFolder + "cmp_createXFAFormTest.pdf";
            PdfDocument doc         = new PdfDocument(new PdfWriter(outFileName));
            XfaForm     xfa         = new XfaForm(new FileStream(XML, FileMode.Open, FileAccess.Read));

            xfa.Write(doc);
            doc.AddNewPage();
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }
Exemplo n.º 5
0
        public virtual void CreateEmptyXFAFormTest02()
        {
            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();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }