public class Splitter extends Object
| Constructor and Description |
|---|
Splitter() |
| Modifier and Type | Method and Description |
|---|---|
protected PDDocument |
createNewDocument()
Create a new document to write the split contents to.
|
protected PDDocument |
getDestinationDocument()
The source PDF document.
|
MemoryUsageSetting |
getMemoryUsageSetting() |
protected PDDocument |
getSourceDocument()
The source PDF document.
|
protected void |
processPage(PDPage page)
Interface to start processing a new page.
|
void |
setEndPage(int end)
This will set the end page.
|
void |
setMemoryUsageSetting(MemoryUsageSetting memoryUsageSetting)
Set the memory setting.
|
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.
|
protected boolean |
splitAtPage(int pageNumber)
Check if it is necessary to create a new document.
|
public MemoryUsageSetting getMemoryUsageSetting()
public void setMemoryUsageSetting(MemoryUsageSetting memoryUsageSetting)
memoryUsageSetting - 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.IllegalArgumentException - if the page is smaller than one.public void setStartPage(int start)
start - the 1-based start pageIllegalArgumentException - if the start page is smaller than one.public void setEndPage(int end)
end - the 1-based end pageIllegalArgumentException - if the end page is smaller than one.protected boolean splitAtPage(int pageNumber)
protected void splitAtPage()
{
// will split at pages with prime numbers only
return isPrime(pageNumber);
}
pageNumber - the 0-based page number to be checked as splitting pageprotected PDDocument createNewDocument() throws IOException
IOException - If there is an problem creating the new document.protected void processPage(PDPage page) throws IOException
page - The page that is about to get processed.IOException - If there is an error creating the new document.protected final PDDocument getSourceDocument()
protected final PDDocument getDestinationDocument()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.