Package org.pdfbox.pdmodel.annotation.interactive

Examples of org.pdfbox.pdmodel.annotation.interactive.PDAcroForm


        {
            COSDictionary acroFormDic =
                (COSDictionary)root.getDictionaryObject( COSName.ACRO_FORM );
            if( acroFormDic == null )
            {
                acroForm = new PDAcroForm( document );
                root.setItem( COSName.ACRO_FORM, acroForm.getDictionary() );
            }
            else
            {
                acroForm = new PDAcroForm( document, acroFormDic );
            }
        }
        return acroForm;
    }
View Full Code Here


     * @throws IOException If there is an error setting the data in the field.
     */
    public void importFDF( PDDocument pdfDocument, COSDocument fdfDocument ) throws IOException
    {
        PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
        PDAcroForm acroForm = docCatalog.getAcroForm();
        acroForm.setCacheFields( true );

        COSDictionary trailer = fdfDocument.getTrailer();
        COSDictionary root = (COSDictionary)trailer.getDictionaryObject( COSName.ROOT );
        COSDictionary fdf = (COSDictionary)root.getDictionaryObject( COSName.getPDFName( "FDF" ) );
        if( fdf != null )
        {
            COSArray fields = (COSArray)fdf.getDictionaryObject( COSName.getPDFName( "Fields" ) );
            for( int i=0; i<fields.size(); i++ )
            {
                COSDictionary fdfField = (COSDictionary)fields.getObject( i );
                COSString fieldName = (COSString)fdfField.getDictionaryObject( COSName.getPDFName( "T" ) );
                System.out.println( "Processing " + fieldName );
                PDField docField = acroForm.getField( fieldName.getString() );
                if( docField != null )
                {
                    docField.importFDF( fdfField );
                }
            }
View Full Code Here

     * @throws IOException If there is an error setting the field.
     */
    public void setField( PDDocument pdfDocument, String name, String value ) throws IOException
    {
        PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
        PDAcroForm acroForm = docCatalog.getAcroForm();
        PDField field = acroForm.getField( name );
        if( field != null )
        {
            field.setValue( value );
        }
        else
View Full Code Here

     * @param pdfDocument The PDF to get the fields from.
     */
    public void printFields( PDDocument pdfDocument )
    {
        PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
        PDAcroForm acroForm = docCatalog.getAcroForm();
        List fields = acroForm.getFields();
        Iterator fieldsIter = fields.iterator();

        while( fieldsIter.hasNext() )
        {
            PDField field = (PDField)fieldsIter.next();
View Full Code Here

TOP

Related Classes of org.pdfbox.pdmodel.annotation.interactive.PDAcroForm

Copyright © 2018 www.massapicom. 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.