com.lowagie.text.pdf

Class FdfWriter

public class FdfWriter extends Object

Writes an FDF form.

Author: Paulo Soares (psoares@consiste.pt)

Nested Class Summary
static classFdfWriter.Wrt
Field Summary
HashMapfields
Stringfile
The PDF file associated with the FDF.
static byte[]HEADER_FDF
Constructor Summary
FdfWriter()
Creates a new FdfWriter.
Method Summary
StringgetField(String field)
Gets the field value.
HashMapgetFields()
Gets all the fields.
StringgetFile()
Gets the PDF file name associated with the FDF.
voiditerateFields(HashMap values, HashMap map, String name)
booleanremoveField(String field)
Removes the field value.
booleansetField(String field, PdfObject value)
booleansetFieldAsAction(String field, PdfAction action)
Sets the field value as a PDFAction.
booleansetFieldAsName(String field, String value)
Sets the field value as a name.
booleansetFieldAsString(String field, String value)
Sets the field value as a string.
voidsetFields(FdfReader fdf)
Sets all the fields from this FdfReader
voidsetFields(PdfReader pdf)
Sets all the fields from this PdfReader
voidsetFields(AcroFields af)
Sets all the fields from this AcroFields
voidsetFile(String file)
Sets the PDF file name associated with the FDF.
voidwriteTo(OutputStream os)
Writes the content to a stream.

Field Detail

fields

HashMap fields

file

private String file
The PDF file associated with the FDF.

HEADER_FDF

private static final byte[] HEADER_FDF

Constructor Detail

FdfWriter

public FdfWriter()
Creates a new FdfWriter.

Method Detail

getField

public String getField(String field)
Gets the field value.

Parameters: field the field name

Returns: the field value or null if not found

getFields

public HashMap getFields()
Gets all the fields. The map is keyed by the fully qualified field name and the values are PdfObject.

Returns: a map with all the fields

getFile

public String getFile()
Gets the PDF file name associated with the FDF.

Returns: the PDF file name associated with the FDF

iterateFields

void iterateFields(HashMap values, HashMap map, String name)

removeField

public boolean removeField(String field)
Removes the field value.

Parameters: field the field name

Returns: true if the field was found and removed, false otherwise

setField

boolean setField(String field, PdfObject value)

setFieldAsAction

public boolean setFieldAsAction(String field, PdfAction action)
Sets the field value as a PDFAction. For example, this method allows setting a form submit button action using (String, Object[], int). This method creates an A entry for the specified field in the underlying FDF file. Method contributed by Philippe Laflamme (plaflamme)

Parameters: field the fully qualified field name action the field's action

Returns: true if the value was inserted, false if the name is incompatible with an existing field

Since: 2.1.5

setFieldAsName

public boolean setFieldAsName(String field, String value)
Sets the field value as a name.

Parameters: field the fully qualified field name value the value

Returns: true if the value was inserted, false if the name is incompatible with an existing field

setFieldAsString

public boolean setFieldAsString(String field, String value)
Sets the field value as a string.

Parameters: field the fully qualified field name value the value

Returns: true if the value was inserted, false if the name is incompatible with an existing field

setFields

public void setFields(FdfReader fdf)
Sets all the fields from this FdfReader

Parameters: fdf the FdfReader

setFields

public void setFields(PdfReader pdf)
Sets all the fields from this PdfReader

Parameters: pdf the PdfReader

setFields

public void setFields(AcroFields af)
Sets all the fields from this AcroFields

Parameters: af the AcroFields

setFile

public void setFile(String file)
Sets the PDF file name associated with the FDF.

Parameters: file the PDF file name associated with the FDF

writeTo

public void writeTo(OutputStream os)
Writes the content to a stream.

Parameters: os the stream

Throws: IOException on error