| |
|
| java.lang.Object org.pdfbox.util.Splitter
Splitter | public class Splitter (Code) | | Split a document into several other documents.
author: Mario Ivankovits (mario@ops.co.at) author: Ben Litchfield version: $Revision: 1.7 $ |
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. | public int | getSplitAtPage() This will return how many pages each split document will contain. | 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. | public void | setSplitAtPage(int split) This will tell the splitting algorithm where to split the pages. | public List | split(PDDocument document) This will take a document and split into several other documents.
Parameters: document - The document to split. |
currentDocument | protected PDDocument currentDocument(Code) | | The current PDF document that contains the splitted page.
|
pageNumber | protected int pageNumber(Code) | | The current page number that we are processing, zero based.
|
createNewDocument | protected void createNewDocument() throws IOException(Code) | | Create a new document to write the splitted contents to.
throws: IOException - If there is an problem creating the new document. |
createNewDocumentIfNecessary | protected void createNewDocumentIfNecessary() throws IOException(Code) | | Interface method, you can control where a document gets split by implementing
this method. By default a split occurs at every page. If you wanted to split
based on some complex logic then you could override this method. For example.
protected void createNewDocumentIfNecessary()
{
if( isPrime( pageNumber ) )
{
super.createNewDocumentIfNecessary();
}
}
throws: IOException - If there is an error creating the new document. |
getSplitAtPage | public int getSplitAtPage()(Code) | | This will return how many pages each split document will contain.
The split parameter. |
isNewDocNecessary | protected boolean isNewDocNecessary()(Code) | | Check if it is necessary to create a new document.
true If a new document should be created. |
processNextPage | protected void processNextPage(PDPage page) throws IOException(Code) | | Interface to start processing a new page.
Parameters: page - The page that is about to get processed. throws: IOException - If there is an error creating the new document. |
processPages | protected void processPages(List pages) throws IOException(Code) | | Interface method to handle the start of the page processing.
Parameters: pages - The list of pages from the source document. throws: IOException - If an IO error occurs. |
setSplitAtPage | public void setSplitAtPage(int split)(Code) | | This will tell the splitting algorithm where to split the pages. The default
is 1, so every page will become a new document. If it was to then each document would
contain 2 pages. So it the source document had 5 pages it would split into
3 new documents, 2 documents containing 2 pages and 1 document containing one
page.
Parameters: split - The number of pages each split document should contain. |
split | public List split(PDDocument document) throws IOException(Code) | | This will take a document and split into several other documents.
Parameters: document - The document to split. A list of all the split documents. throws: IOException - If there is an IOError |
|
|
|