Class SetField
- java.lang.Object
-
- org.apache.pdfbox.examples.interactive.form.SetField
-
public class SetField extends java.lang.ObjectThis example will take a PDF document and set a form field in it.
-
-
Constructor Summary
Constructors Constructor Description SetField()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.StringcalculateOutputFilename(java.lang.String filename)static voidmain(java.lang.String[] args)This will read a PDF file and set a field and then write it the pdf out again.private voidsetField(java.lang.String[] args)voidsetField(PDDocument pdfDocument, java.lang.String name, java.lang.String value)This will set a single field in the document.private static voidusage()This will print out a message telling how to use this example.
-
-
-
Method Detail
-
setField
public void setField(PDDocument pdfDocument, java.lang.String name, java.lang.String value) throws java.io.IOException
This will set a single field in the document.- Parameters:
pdfDocument- The PDF to set the field in.name- The name of the field to set.value- The new value of the field.- Throws:
java.io.IOException- If there is an error setting the field.
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionThis will read a PDF file and set a field and then write it the pdf out again.
see usage() for commandline- Parameters:
args- command line arguments- Throws:
java.io.IOException- If there is an error importing the FDF document.
-
setField
private void setField(java.lang.String[] args) throws java.io.IOException- Throws:
java.io.IOException
-
calculateOutputFilename
private static java.lang.String calculateOutputFilename(java.lang.String filename)
-
usage
private static void usage()
This will print out a message telling how to use this example.
-
-