Examples of PDFieldTreeNode


Examples of org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode

                destAcroForm.setFields(destFields);
            }
            Iterator<PDFieldTreeNode> srcFieldsIterator = srcFields.iterator();
            while (srcFieldsIterator.hasNext())
            {
                PDFieldTreeNode srcField = srcFieldsIterator.next();
                PDFieldTreeNode destFieldNode = PDFieldTreeNode.createField(destAcroForm,
                        (COSDictionary) cloner.cloneForNewDocument(srcField.getDictionary()), null);
                // if the form already has a field with this name then we need to rename this field
                // to prevent merge conflicts.
                if (destAcroForm.getField(destFieldNode.getFullyQualifiedName()) != null)
                {
                    destFieldNode.setPartialName("dummyFieldName" + (nextFieldNum++));
                }
                destFields.add(destFieldNode);
            }
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode

       
        // as there might not be an AcroForm entry a null check is necessary
        if (acroForm != null)
        {
            // Retrieve an individual field and set it's value.
            PDFieldTreeNode field = acroForm.getField( "sampleField" );
            field.setValue("Text Entry");

            // If a field is nested within the form tree a fully qualified name
            // might be provided to access the field.
            field = acroForm.getField( "fieldsContainer.nestedSampleField" );
            field.setValue("Text Entry");
        }

        // Save and close the filled out form.
        pdfDocument.save(filledForm);
        pdfDocument.close();
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode

     */
    public void setField(PDDocument pdfDocument, String name, String value) throws IOException
    {
        PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
        PDAcroForm acroForm = docCatalog.getAcroForm();
        PDFieldTreeNode field = acroForm.getField(name);
        if (field != null)
        {
            field.setValue(value);
        }
        else
        {
            System.err.println("No field found with name:" + name);
        }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode

        System.out.println(new Integer(fields.size()).toString() + " top-level fields were found on the form");

        while (fieldsIter.hasNext())
        {
            PDFieldTreeNode field = fieldsIter.next();
            processField(field, "|--", field.getPartialName());
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode

            while (kidsIter.hasNext())
            {
                Object pdfObj = kidsIter.next();
                if (pdfObj instanceof PDFieldTreeNode)
                {
                    PDFieldTreeNode kid = (PDFieldTreeNode) pdfObj;
                    processField(kid, "|  " + sLevel, sParent);
                }
            }
        }
        else
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode

                fdf = FDFDocument.load( fileFDF );
                PDAcroForm form = freedom.getDocumentCatalog().getAcroForm();
                form.importFDF( fdf );
                PDTextField feld2 = (PDTextField)form.getField( "eeFirstName" );
                List<COSObjectable> kids = feld2.getKids();
                PDFieldTreeNode firstKid = (PDFieldTreeNode)kids.get( 0 );
                PDFieldTreeNode secondKid = (PDFieldTreeNode)kids.get( 1 );
                testContentStreamContains( freedom, firstKid, "Steve" );
                testContentStreamContains( freedom, secondKid, "Steve" );
   
                //the appearance stream is suppose to be null because there
                //is an F action in the AA dictionary that populates that field.
                PDFieldTreeNode totalAmt = form.getField( "eeSuppTotalAmt" );
                assertTrue( totalAmt.getDictionary().getDictionaryObject( COSName.AP ) == null );
   
            }
            finally
            {
                if( freedom != null )
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.