Interface Document
- All Known Implementing Classes:
AbstractDocument, PDFDocument, PSDocument
public interface Document
Interface defining a document that can be handled by the library.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend pages of another document to the current document.explode()Separate each pages to a new document.extract(int begin, int end) Return a new document containing pages of a given range.byte[]Return document content as a byte arrayintReturn document page countintgetSize()Return document sizegetType()Return the type of the document.voidLoad document from a File.voidload(InputStream inputStream) Load document from an InputStream.voidWrite document to a File.voidwrite(OutputStream outputStream) Write document to an OutputStream
-
Field Details
-
TYPE_POSTSCRIPT
- See Also:
-
TYPE_PDF
- See Also:
-
-
Method Details
-
load
Load document from a File.- Parameters:
file- File.- Throws:
FileNotFoundExceptionIOException
-
load
Load document from an InputStream.- Parameters:
inputStream-- Throws:
IOException
-
write
Write document to a File.- Parameters:
file- File.- Throws:
IOException
-
write
Write document to an OutputStream- Parameters:
outputStream-- Throws:
IOException
-
getPageCount
Return document page count- Returns:
- Number of pages.
- Throws:
DocumentException
-
getType
String getType()Return the type of the document.- Returns:
- A String representing the document type name.
-
getSize
int getSize()Return document size- Returns:
- Document size in bytes.
-
getContent
byte[] getContent()Return document content as a byte array- Returns:
- Byte array
-
extract
Return a new document containing pages of a given range. Note : begin and end indicies start at 1- Parameters:
begin- Index of the first page to extractend- Index of the last page to extract- Returns:
- A new document.
- Throws:
DocumentException
-
append
Append pages of another document to the current document.- Parameters:
document- Document ot append- Throws:
DocumentException
-
explode
Separate each pages to a new document.- Returns:
- A list of Document.
- Throws:
DocumentException
-