Top Description Constructors Methods
org.apache.pdfbox.examples.interactive.form

public Class SetField

extends Object
Class Inheritance
Imports
java.io.File, .IOException, org.apache.pdfbox.Loader, org.apache.pdfbox.pdmodel.PDDocument, .PDDocumentCatalog, org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm, .PDCheckBox, .PDComboBox, .PDField, .PDListBox, .PDRadioButton, .PDTextField

This example will take a PDF document and set a form field in it.
Author
Ben Litchfield

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static String
public static void
main(String[]
command line arguments
args
)

This will read a PDF file and set a field and then write it the pdf out again.

public void
setField(PDDocument
The PDF to set the field in.
pdfDocument
,
String
The name of the field to set.
name
,
String
The new value of the field.
value
)

This will set a single field in the document.

private void
setField(String[] args)

private static void
usage()

This will print out a message telling how to use this example.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SetFieldback to summary
public SetField()

Method Detail

calculateOutputFilenameback to summary
private static String calculateOutputFilename(String filename)
mainback to summary
public static void main(String[] args) throws IOException

This will read a PDF file and set a field and then write it the pdf out again.
see usage() for commandline

Parameters
args:String[]

command line arguments

Exceptions
IOException:
If there is an error importing the FDF document.
setFieldback to summary
public void setField(PDDocument pdfDocument, String name, String value) throws IOException

This will set a single field in the document.

Parameters
pdfDocument:PDDocument

The PDF to set the field in.

name:String

The name of the field to set.

value:String

The new value of the field.

Exceptions
IOException:
If there is an error setting the field.
setFieldback to summary
private void setField(String[] args) throws IOException
usageback to summary
private static void usage()

This will print out a message telling how to use this example.