Package org.apache.pdfbox.pdmodel.fdf
Class FDFDocument
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.fdf.FDFDocument
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class FDFDocument extends java.lang.Object implements java.io.CloseableThis is the in-memory representation of the FDF document. You need to call close() on this object when you are done using it!!
-
-
Field Summary
Fields Modifier and Type Field Description private COSDocumentdocumentprivate RandomAccessReadfdfSourceprivate static org.apache.commons.logging.LogLOG
-
Constructor Summary
Constructors Constructor Description FDFDocument()Constructor, creates a new FDF document.FDFDocument(COSDocument doc)Deprecated.FDFDocument(COSDocument doc, RandomAccessRead source)Constructor that uses an existing document.FDFDocument(org.w3c.dom.Document doc)This will create an FDF document from an XFDF XML document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()This will close the underlying COSDocument object.FDFCataloggetCatalog()This will get the FDF Catalog.COSDocumentgetDocument()This will get the low level document.voidsave(java.io.File fileName)This will save this document to the filesystem.voidsave(java.io.OutputStream output)This will save the document to an output stream.voidsave(java.lang.String fileName)This will save this document to the filesystem.voidsaveXFDF(java.io.File fileName)This will save this document to the filesystem.voidsaveXFDF(java.io.Writer output)This will save the document to an output stream and close the stream.voidsaveXFDF(java.lang.String fileName)This will save this document to the filesystem.voidsetCatalog(FDFCatalog cat)This will set the FDF catalog for this FDF document.voidwriteXML(java.io.Writer output)This will write this element as an XML document.
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
document
private final COSDocument document
-
fdfSource
private final RandomAccessRead fdfSource
-
-
Constructor Detail
-
FDFDocument
public FDFDocument()
Constructor, creates a new FDF document.
-
FDFDocument
@Deprecated public FDFDocument(COSDocument doc)
Deprecated.Constructor that uses an existing document. The COSDocument that is passed in must be valid.- Parameters:
doc- The COSDocument that this document wraps.
-
FDFDocument
public FDFDocument(COSDocument doc, RandomAccessRead source)
Constructor that uses an existing document. The COSDocument that is passed in must be valid.- Parameters:
doc- The COSDocument that this document wraps.source- The source that will be closed when this document gets closed, can be null.
-
FDFDocument
public FDFDocument(org.w3c.dom.Document doc) throws java.io.IOExceptionThis will create an FDF document from an XFDF XML document.- Parameters:
doc- The XML document that contains the XFDF data.- Throws:
java.io.IOException- If there is an error reading from the dom.
-
-
Method Detail
-
writeXML
public void writeXML(java.io.Writer output) throws java.io.IOExceptionThis will write this element as an XML document.- Parameters:
output- The stream to write the xml to.- Throws:
java.io.IOException- If there is an error writing the XML.
-
getDocument
public COSDocument getDocument()
This will get the low level document.- Returns:
- The document that this layer sits on top of.
-
getCatalog
public FDFCatalog getCatalog()
This will get the FDF Catalog. This is guaranteed to not return null.- Returns:
- The documents /Root dictionary
-
setCatalog
public final void setCatalog(FDFCatalog cat)
This will set the FDF catalog for this FDF document.- Parameters:
cat- The FDF catalog.
-
save
public void save(java.io.File fileName) throws java.io.IOExceptionThis will save this document to the filesystem.- Parameters:
fileName- The file to save as.- Throws:
java.io.IOException- If there is an error saving the document.
-
save
public void save(java.lang.String fileName) throws java.io.IOExceptionThis will save this document to the filesystem.- Parameters:
fileName- The file to save as.- Throws:
java.io.IOException- If there is an error saving the document.
-
save
public void save(java.io.OutputStream output) throws java.io.IOExceptionThis will save the document to an output stream.- Parameters:
output- The stream to write to.- Throws:
java.io.IOException- If there is an error writing the document.
-
saveXFDF
public void saveXFDF(java.io.File fileName) throws java.io.IOExceptionThis will save this document to the filesystem.- Parameters:
fileName- The file to save as.- Throws:
java.io.IOException- If there is an error saving the document.
-
saveXFDF
public void saveXFDF(java.lang.String fileName) throws java.io.IOExceptionThis will save this document to the filesystem.- Parameters:
fileName- The file to save as.- Throws:
java.io.IOException- If there is an error saving the document.
-
saveXFDF
public void saveXFDF(java.io.Writer output) throws java.io.IOExceptionThis will save the document to an output stream and close the stream.- Parameters:
output- The stream to write to.- Throws:
java.io.IOException- If there is an error writing the document.
-
close
public void close() throws java.io.IOExceptionThis will close the underlying COSDocument object.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException- If there is an error releasing resources.
-
-