Package org.ghost4j.document
Interface Document
-
- All Known Implementing Classes:
AbstractDocument,PDFDocument,PSDocument
public interface DocumentInterface defining a document that can be handled by the library.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringTYPE_PDFstatic java.lang.StringTYPE_POSTSCRIPT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidappend(Document document)Append pages of another document to the current document.java.util.List<Document>explode()Separate each pages to a new document.Documentextract(int begin, int end)Return a new document containing pages of a given range.byte[]getContent()Return document content as a byte arrayintgetPageCount()Return document page countintgetSize()Return document sizejava.lang.StringgetType()Return the type of the document.voidload(java.io.File file)Load document from a File.voidload(java.io.InputStream inputStream)Load document from an InputStream.voidwrite(java.io.File file)Write document to a File.voidwrite(java.io.OutputStream outputStream)Write document to an OutputStream
-
-
-
Field Detail
-
TYPE_POSTSCRIPT
static final java.lang.String TYPE_POSTSCRIPT
- See Also:
- Constant Field Values
-
TYPE_PDF
static final java.lang.String TYPE_PDF
- See Also:
- Constant Field Values
-
-
Method Detail
-
load
void load(java.io.File file) throws java.io.FileNotFoundException, java.io.IOExceptionLoad document from a File.- Parameters:
file- File.- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
load
void load(java.io.InputStream inputStream) throws java.io.IOException
Load document from an InputStream.- Parameters:
inputStream-- Throws:
java.io.IOException
-
write
void write(java.io.File file) throws java.io.IOExceptionWrite document to a File.- Parameters:
file- File.- Throws:
java.io.IOException
-
write
void write(java.io.OutputStream outputStream) throws java.io.IOExceptionWrite document to an OutputStream- Parameters:
outputStream-- Throws:
java.io.IOException
-
getPageCount
int getPageCount() throws DocumentExceptionReturn document page count- Returns:
- Number of pages.
- Throws:
DocumentException
-
getType
java.lang.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
Document extract(int begin, int end) throws DocumentException
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
void append(Document document) throws DocumentException
Append pages of another document to the current document.- Parameters:
document- Document ot append- Throws:
DocumentException
-
explode
java.util.List<Document> explode() throws DocumentException
Separate each pages to a new document.- Returns:
- A list of Document.
- Throws:
DocumentException
-
-