|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pdfbox.util.Splitter
public class Splitter
Split a document into several other documents.
Field Summary | |
---|---|
protected PDDocument |
currentDocument
The current PDF document that contains the splitted page. |
protected int |
pageNumber
The current page number that we are processing, zero based. |
protected PDDocument |
pdfDocument
The source PDF document. |
Constructor Summary | |
---|---|
Splitter()
|
Method Summary | |
---|---|
protected void |
createNewDocument()
Create a new document to write the splitted contents to. |
protected void |
createNewDocumentIfNecessary()
Interface method, you can control where a document gets split by implementing this method. |
int |
getEndPage()
This will return the end page. |
int |
getSplitAtPage()
This will return how many pages each split document will contain. |
int |
getStartPage()
This will return the start page. |
protected boolean |
isNewDocNecessary()
Check if it is necessary to create a new document. |
protected void |
processNextPage(PDPage page)
Interface to start processing a new page. |
protected void |
processPages(List pages)
Interface method to handle the start of the page processing. |
void |
setEndPage(int end)
This will set the end page. |
void |
setSplitAtPage(int split)
This will tell the splitting algorithm where to split the pages. |
void |
setStartPage(int start)
This will set the start page. |
List<PDDocument> |
split(PDDocument document)
This will take a document and split into several other documents. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PDDocument pdfDocument
protected PDDocument currentDocument
protected int pageNumber
Constructor Detail |
---|
public Splitter()
Method Detail |
---|
public List<PDDocument> split(PDDocument document) throws IOException
document
- The document to split.
IOException
- If there is an IOErrorpublic void setSplitAtPage(int split)
split
- The number of pages each split document should contain.public int getSplitAtPage()
public void setStartPage(int start)
start
- the start pagepublic int getStartPage()
public void setEndPage(int end)
end
- the end pagepublic int getEndPage()
protected void processPages(List pages) throws IOException
pages
- The list of pages from the source document.
IOException
- If an IO error occurs.protected void createNewDocumentIfNecessary() throws IOException
protected void createNewDocumentIfNecessary()
{
if( isPrime( pageNumber ) )
{
super.createNewDocumentIfNecessary();
}
}
IOException
- If there is an error creating the new document.protected boolean isNewDocNecessary()
protected void createNewDocument() throws IOException
IOException
- If there is an problem creating the new document.protected void processNextPage(PDPage page) throws IOException
page
- The page that is about to get processed.
IOException
- If there is an error creating the new document.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |