Class FDFDocument
java.lang.Object
org.apache.pdfbox.pdmodel.fdf.FDFDocument
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor, creates a new FDF document.FDFDocument(COSDocument doc) Constructor that uses an existing document.FDFDocument(Document doc) This will create an FDF document from an XFDF XML document. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This will close the underlying COSDocument object.This will get the FDF Catalog.This will get the low level document.static FDFDocumentThis will load a document from a file.static FDFDocumentload(InputStream input) This will load a document from an input stream.static FDFDocumentThis will load a document from a file.static FDFDocumentThis will load a document from a file.static FDFDocumentloadXFDF(InputStream input) This will load a document from an input stream.static FDFDocumentThis will load a document from a file.voidThis will save this document to the filesystem.voidsave(OutputStream output) This will save the document to an output stream.voidThis will save this document to the filesystem.voidThis will save this document to the filesystem.voidThis will save the document to an output stream and close the stream.voidThis will save this document to the filesystem.voidsetCatalog(FDFCatalog cat) This will set the FDF catalog for this FDF document.voidThis will write this element as an XML document.
-
Constructor Details
-
FDFDocument
public FDFDocument()Constructor, creates a new FDF document. -
FDFDocument
Constructor that uses an existing document. The COSDocument that is passed in must be valid.- Parameters:
doc- The COSDocument that this document wraps.
-
FDFDocument
This will create an FDF document from an XFDF XML document.- Parameters:
doc- The XML document that contains the XFDF data.- Throws:
IOException- If there is an error reading from the dom.
-
-
Method Details
-
writeXML
This will write this element as an XML document.- Parameters:
output- The stream to write the xml to.- Throws:
IOException- If there is an error writing the XML.
-
getDocument
This will get the low level document.- Returns:
- The document that this layer sits on top of.
-
getCatalog
This will get the FDF Catalog. This is guaranteed to not return null.- Returns:
- The documents /Root dictionary
-
setCatalog
This will set the FDF catalog for this FDF document.- Parameters:
cat- The FDF catalog.
-
load
This will load a document from a file.- Parameters:
filename- The name of the file to load.- Returns:
- The document that was loaded.
- Throws:
IOException- If there is an error reading from the stream.
-
load
This will load a document from a file.- Parameters:
file- The name of the file to load.- Returns:
- The document that was loaded.
- Throws:
IOException- If there is an error reading from the stream.
-
load
This will load a document from an input stream.- Parameters:
input- The stream that contains the document.- Returns:
- The document that was loaded.
- Throws:
IOException- If there is an error reading from the stream.
-
loadXFDF
This will load a document from a file.- Parameters:
filename- The name of the file to load.- Returns:
- The document that was loaded.
- Throws:
IOException- If there is an error reading from the stream.
-
loadXFDF
This will load a document from a file.- Parameters:
file- The name of the file to load.- Returns:
- The document that was loaded.
- Throws:
IOException- If there is an error reading from the stream.
-
loadXFDF
This will load a document from an input stream.- Parameters:
input- The stream that contains the document.- Returns:
- The document that was loaded.
- Throws:
IOException- If there is an error reading from the stream.
-
save
This will save this document to the filesystem.- Parameters:
fileName- The file to save as.- Throws:
IOException- If there is an error saving the document.
-
save
This will save this document to the filesystem.- Parameters:
fileName- The file to save as.- Throws:
IOException- If there is an error saving the document.
-
save
This will save the document to an output stream.- Parameters:
output- The stream to write to.- Throws:
IOException- If there is an error writing the document.
-
saveXFDF
This will save this document to the filesystem.- Parameters:
fileName- The file to save as.- Throws:
IOException- If there is an error saving the document.
-
saveXFDF
This will save this document to the filesystem.- Parameters:
fileName- The file to save as.- Throws:
IOException- If there is an error saving the document.
-
saveXFDF
This will save the document to an output stream and close the stream.- Parameters:
output- The stream to write to.- Throws:
IOException- If there is an error writing the document.
-
close
This will close the underlying COSDocument object.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- If there is an error releasing resources.
-