org.pdfbox.examples.persistence
Class FieldsDoc

java.lang.Object
  extended byorg.pdfbox.examples.persistence.FieldsDoc

public class FieldsDoc
extends Object

This example fills a field in a pdf document and writes it to new destination.

Version:
$Revision: 1.5 $
Author:
Michael Traut

Constructor Summary
FieldsDoc()
          Constructor.
 
Method Summary
 void doIt(String in, String out, String name, String value)
          fill a field in the pdf.
static void main(String[] args)
          This will fill a field in a PDF document.
 void setField(COSDocument doc, COSString name, COSString value)
          lookup and fill the field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldsDoc

public FieldsDoc()
Constructor.

Method Detail

doIt

public void doIt(String in,
                 String out,
                 String name,
                 String value)
          throws IOException,
                 COSVisitorException
fill a field in the pdf.

Parameters:
in - The template file
out - The file to write the PDF to.
name - The name of the PDF field (FDF field)
value - The value to be used for the field
Throws:
IOException - If there is an error writing the data.
COSVisitorException - If there is an error generating the PDF document.

main

public static void main(String[] args)
This will fill a field in a PDF document.
see usage() for commandline

Parameters:
args - command line arguments

setField

public void setField(COSDocument doc,
                     COSString name,
                     COSString value)
lookup and fill the field. todo: this method will go to the pdfmodel package one day

Parameters:
doc - the document where the field resides
name - the name of the PDF Annotation field
value - The desired value to be used for the field