pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lorena Leishman <lorenaleish...@yahoo.com.INVALID>
Subject Fw: Missing classes
Date Fri, 09 Jan 2015 16:07:33 GMT
I meant I haven't been able to run any example code successfully.
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

Are these classes in a different jar? 
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();    }}

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message