pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Maruan Sahyoun <sahy...@fileaffairs.de>
Subject Re: Missing classes
Date Fri, 09 Jan 2015 17:36:27 GMT
Hi,

PDFieldTreeNode and PDTextField are for PDFBox 2.0

for 1.8 use PDField and PDTextbox instead [http://pdfbox.apache.org/docs/1.8.8/javadocs/org/apache/pdfbox/pdmodel/interactive/form/package-summary.html]

BR

Maruan

Am 09.01.2015 um 17:04 schrieb Lorena Leishman <lorenaleishman@yahoo.com.INVALID>:

> Hello I installed pdfbox-app-1.8.8.jar and I have been able to run any example codes
successfully. I am working on this one and I get  "cannot find symbol" on import org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode;import
org.apache.pdfbox.pdmodel.interactive.form.PDTextField;
> 
> Are these classes in a different jar? 
> Code:
> package org.apache.pdfbox.examples.acroforms;import java.io.File;import java.io.IOException;
> import org.apache.pdfbox.pdmodel.PDDocument;
> import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
> import org.apache.pdfbox.pdmodel.interactive.form.PDField;
> import org.apache.pdfbox.pdmodel.interactive.form.PDFieldTreeNode;
> import org.apache.pdfbox.pdmodel.interactive.form.PDTextField;
> 
> 
> public class FillTestField {    public static void main(String[] args) throws IOException
   {      String formTemplate = "Users/Dad/Desktop/TCRM/game plan 12-16.pdf";            String
filledForm = "Users/Dad/JavaTest/game plan 12-16.pdf";               // load the document
          PDDocument pdfDocument = PDDocument                  .load(new File(formTemplate),null);
       // get the document catalog           PDAcroForm acroForm = pdfDocument.getDocumentCatalog().getAcroForm();
            // 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.
           PDTextField field = (PDTextField) acroForm.getField( "Goal" );            field.setValue("Testing");
                       // If a field is nested within the form tree a fully qualified name
            // might be provided to access the field.            field = (PDTextField) acroForm.getField(
"fieldsContainer.nestedSampleField" );           field.setValue("Text Entry");        }
>  // Save and close the filled out form.        pdfDocument.save(filledForm);
> pdfDocument.close();    }}
>  
> 


Mime
View raw message