Package org.ghost4j.document
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 TypeMethodDescriptionvoid
Append 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 arrayint
Return document page countint
getSize()
Return document sizegetType()
Return the type of the document.void
Load document from a File.void
load
(InputStream inputStream) Load document from an InputStream.void
Write document to a File.void
write
(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:
FileNotFoundException
IOException
-
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
-