Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.fdf

public Class FDFDocument

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.BufferedWriter, .Closeable, .File, .FileOutputStream, .IOException, .OutputStream, .OutputStreamWriter, .Writer, java.nio.charset.StandardCharsets, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.cos.COSDictionary, .COSDocument, .COSName, org.apache.pdfbox.io.IOUtils, .RandomAccessRead, org.apache.pdfbox.pdfwriter.COSWriter, org.w3c.dom.Document, .Element

This is the in-memory representation of the FDF document. You need to call close() on this object when you are done using it!!
Author
Ben Litchfield

Field Summary

Modifier and TypeField and Description
private final COSDocument
private final RandomAccessRead
private static final Log

Constructor Summary

AccessConstructor and Description
public
FDFDocument()

Constructor, creates a new FDF document.

public
FDFDocument(COSDocument
The COSDocument that this document wraps.
doc
)

Constructor that uses an existing document.

public
FDFDocument(COSDocument
The COSDocument that this document wraps.
doc
,
RandomAccessRead
The source that will be closed when this document gets closed, can be null.
source
)

Constructor that uses an existing document.

public
FDFDocument(Document
The XML document that contains the XFDF data.
doc
)

This will create an FDF document from an XFDF XML document.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

This will close the underlying COSDocument object.

public FDFCatalog

Returns:

The documents /Root dictionary
getCatalog
()

This will get the FDF Catalog.

public COSDocument

Returns:

The document that this layer sits on top of.
getDocument
()

This will get the low level document.

public void
save(File
The file to save as.
fileName
)

This will save this document to the filesystem.

public void
save(String
The file to save as.
fileName
)

This will save this document to the filesystem.

public void
save(OutputStream
The stream to write to.
output
)

This will save the document to an output stream.

public void
saveXFDF(File
The file to save as.
fileName
)

This will save this document to the filesystem.

public void
saveXFDF(String
The file to save as.
fileName
)

This will save this document to the filesystem.

public void
saveXFDF(Writer
The stream to write to.
output
)

This will save the document to an output stream and close the stream.

public final void
setCatalog(FDFCatalog
The FDF catalog.
cat
)

This will set the FDF catalog for this FDF document.

public void
writeXML(Writer
The stream to write the xml to.
output
)

This will write this element as an XML document.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

documentback to summary
private final COSDocument document
fdfSourceback to summary
private final RandomAccessRead fdfSource
LOGback to summary
private static final Log LOG

Constructor Detail

FDFDocumentback to summary
public FDFDocument()

Constructor, creates a new FDF document.

FDFDocumentback to summary
public FDFDocument(COSDocument doc)

Constructor that uses an existing document. The COSDocument that is passed in must be valid.

Parameters
doc:COSDocument

The COSDocument that this document wraps.

Annotations
@Deprecated
FDFDocumentback to summary
public FDFDocument(COSDocument doc, RandomAccessRead source)

Constructor that uses an existing document. The COSDocument that is passed in must be valid.

Parameters
doc:COSDocument

The COSDocument that this document wraps.

source:RandomAccessRead

The source that will be closed when this document gets closed, can be null.

FDFDocumentback to summary
public FDFDocument(Document doc) throws IOException

This will create an FDF document from an XFDF XML document.

Parameters
doc:Document

The XML document that contains the XFDF data.

Exceptions
IOException:
If there is an error reading from the dom.

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

This will close the underlying COSDocument object.

Annotations
@Override
Exceptions
IOException:
If there is an error releasing resources.
getCatalogback to summary
public FDFCatalog getCatalog()

This will get the FDF Catalog. This is guaranteed to not return null.

Returns:FDFCatalog

The documents /Root dictionary

getDocumentback to summary
public COSDocument getDocument()

This will get the low level document.

Returns:COSDocument

The document that this layer sits on top of.

saveback to summary
public void save(File fileName) throws IOException

This will save this document to the filesystem.

Parameters
fileName:File

The file to save as.

Exceptions
IOException:
If there is an error saving the document.
saveback to summary
public void save(String fileName) throws IOException

This will save this document to the filesystem.

Parameters
fileName:String

The file to save as.

Exceptions
IOException:
If there is an error saving the document.
saveback to summary
public void save(OutputStream output) throws IOException

This will save the document to an output stream.

Parameters
output:OutputStream

The stream to write to.

Exceptions
IOException:
If there is an error writing the document.
saveXFDFback to summary
public void saveXFDF(File fileName) throws IOException

This will save this document to the filesystem.

Parameters
fileName:File

The file to save as.

Exceptions
IOException:
If there is an error saving the document.
saveXFDFback to summary
public void saveXFDF(String fileName) throws IOException

This will save this document to the filesystem.

Parameters
fileName:String

The file to save as.

Exceptions
IOException:
If there is an error saving the document.
saveXFDFback to summary
public void saveXFDF(Writer output) throws IOException

This will save the document to an output stream and close the stream.

Parameters
output:Writer

The stream to write to.

Exceptions
IOException:
If there is an error writing the document.
setCatalogback to summary
public final void setCatalog(FDFCatalog cat)

This will set the FDF catalog for this FDF document.

Parameters
cat:FDFCatalog

The FDF catalog.

writeXMLback to summary
public void writeXML(Writer output) throws IOException

This will write this element as an XML document.

Parameters
output:Writer

The stream to write the xml to.

Exceptions
IOException:
If there is an error writing the XML.