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 Modifier and Type Field Description static java.lang.String
TYPE_PDF
static java.lang.String
TYPE_POSTSCRIPT
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
append(Document document)
Append pages of another document to the current document.java.util.List<Document>
explode()
Separate each pages to a new document.Document
extract(int begin, int end)
Return a new document containing pages of a given range.byte[]
getContent()
Return document content as a byte arrayint
getPageCount()
Return document page countint
getSize()
Return document sizejava.lang.String
getType()
Return the type of the document.void
load(java.io.File file)
Load document from a File.void
load(java.io.InputStream inputStream)
Load document from an InputStream.void
write(java.io.File file)
Write document to a File.void
write(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.IOException
Load document from a File.- Parameters:
file
- File.- Throws:
java.io.FileNotFoundException
java.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.IOException
Write document to a File.- Parameters:
file
- File.- Throws:
java.io.IOException
-
write
void write(java.io.OutputStream outputStream) throws java.io.IOException
Write document to an OutputStream- Parameters:
outputStream
-- Throws:
java.io.IOException
-
getPageCount
int getPageCount() throws DocumentException
Return 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
-
-