| Modifier and Type | Class and Description |
|---|---|
| private class | Splitter.
Class to help clone the /K tree. |
| Modifier and Type | Field and Description |
|---|---|
| private Map | |
| private PDDocument | |
| private int | |
| private List | |
| private Map | |
| private int | |
| private Set | |
| private static final Log | |
| private Map | |
| private Set | |
| private PDDocument | |
| private int | |
| private int | |
| private RandomAccessStreamCache. | |
| private Map |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private void | cloneStructureTree(PDDocument destinationDocument)
Clone the structure tree from the source to the current destination document. |
| private void | cloneTreeElement(Map<Integer, COSObjectable> srcNumberTreeAsMap, Map<Integer, COSObjectable> dstNumberTreeAsMap, int sp)
|
| protected PDDocument | Returns: the newly created PDDocument.Create a new document to write the split contents to. |
| private void | |
| private void | fixDestinations(PDDocument destinationDocument)
Replace the page destinations, if the source and destination pages are in the target document. |
| protected final PDDocument | |
| protected final PDDocument | |
| public RandomAccessStreamCache. | Returns: the current function to be used to create an instance of stream cache.
|
| private void | processAnnotations(PDPage imported)
Clone all annotations because of changes possibly made, and because the structure tree is cloned. |
| protected void | processPage(PDPage
The page that is about to get processed. page)Interface to start processing a new page. |
| private void | |
| private void | processResources(PDResources res, Map<Integer, COSObjectable> srcNumberTreeAsMap, Map<Integer, COSObjectable> dstNumberTreeAsMap, Set<COSDictionary> visited)
|
| public void | |
| public void | setSplitAtPage(int
The number of pages each split document should contain. split)This will tell the splitting algorithm where to split the pages. |
| public void | |
| public void | setStreamCacheCreateFunction(RandomAccessStreamCache.
the current function to be used to create an instance of stream cache. streamCacheCreateFunctionSet the current function to be used to create an instance of stream cache. |
| public List | Returns: A list of all the split documents. These should all be saved before closing any documents, including the source document. Any further operations should be made after reloading them, to avoid problems due to resource sharing. For the same reason, they should not be saved with encryption.The document to split. document)This will take a document and split into several other documents. |
| protected boolean | Returns: true If a new document should be created.the 0-based page number to be checked as splitting page pageNumber)Check if it is necessary to create a new document. |
| annotDictMap | back to summary |
|---|---|
| private Map<COSDictionary, COSDictionary> annotDictMap | |
| currentDestinationDocument | back to summary |
|---|---|
| private PDDocument currentDestinationDocument | |
| currentPageNumber | back to summary |
|---|---|
| private int currentPageNumber | |
| destinationDocuments | back to summary |
|---|---|
| private List<PDDocument> destinationDocuments | |
| destToFixMap | back to summary |
|---|---|
| private Map<PDPageDestination, PDPage> destToFixMap | |
| endPage | back to summary |
|---|---|
| private int endPage | |
| idSet | back to summary |
|---|---|
| private Set<String> idSet | |
| LOG | back to summary |
|---|---|
| private static final Log LOG | |
| pageDictMap | back to summary |
|---|---|
| private Map<COSDictionary, COSDictionary> pageDictMap | |
| roleSet | back to summary |
|---|---|
| private Set<COSName> roleSet | |
| sourceDocument | back to summary |
|---|---|
| private PDDocument sourceDocument | |
| splitLength | back to summary |
|---|---|
| private int splitLength | |
| startPage | back to summary |
|---|---|
| private int startPage | |
| streamCacheCreateFunction | back to summary |
|---|---|
| private RandomAccessStreamCache. | |
| structDictMap | back to summary |
|---|---|
| private Map<COSDictionary, COSDictionary> structDictMap | |
| Splitter | back to summary |
|---|---|
| public Splitter() | |
| cloneIDTree | back to summary |
|---|---|
| private void cloneIDTree(PDStructureTreeRoot srcStructTree, PDStructureTreeRoot destStructTree) throws IOException | |
| cloneRoleMap | back to summary |
|---|---|
| private void cloneRoleMap(PDStructureTreeRoot srcStructTree, PDStructureTreeRoot destStructTree) | |
| cloneStructureTree | back to summary |
|---|---|
| private void cloneStructureTree(PDDocument destinationDocument) throws IOException Clone the structure tree from the source to the current destination document. | |
| cloneTreeElement | back to summary |
|---|---|
| private void cloneTreeElement(Map<Integer, COSObjectable> srcNumberTreeAsMap, Map<Integer, COSObjectable> dstNumberTreeAsMap, int sp) | |
| createNewDocument | back to summary |
|---|---|
| protected PDDocument createNewDocument() throws IOException Create a new document to write the split contents to.
| |
| createNewDocumentIfNecessary | back to summary |
|---|---|
| private void createNewDocumentIfNecessary() throws IOException Helper method for creating new documents at the appropriate pages.
| |
| fixDestinations | back to summary |
|---|---|
| private void fixDestinations(PDDocument destinationDocument) Replace the page destinations, if the source and destination pages are in the target document. This must be called after all pages (and its annotations) are processed. | |
| getDestinationDocument | back to summary |
|---|---|
| protected final PDDocument getDestinationDocument() The source PDF document.
| |
| getSourceDocument | back to summary |
|---|---|
| protected final PDDocument getSourceDocument() The source PDF document.
| |
| getStreamCacheCreateFunction | back to summary |
|---|---|
public RandomAccessStreamCache.
| |
| processAnnotations | back to summary |
|---|---|
| private void processAnnotations(PDPage imported) throws IOException Clone all annotations because of changes possibly made, and because the structure tree is cloned. | |
| processPage | back to summary |
|---|---|
| protected void processPage(PDPage page) throws IOException Interface to start processing a new page.
| |
| processPages | back to summary |
|---|---|
| private void processPages() throws IOException Interface method to handle the start of the page processing.
| |
| processResources | back to summary |
|---|---|
| private void processResources(PDResources res, Map<Integer, COSObjectable> srcNumberTreeAsMap, Map<Integer, COSObjectable> dstNumberTreeAsMap, Set<COSDictionary> visited) throws IOException | |
| setEndPage | back to summary |
|---|---|
| public void setEndPage(int end) This will set the end page.
| |
| setSplitAtPage | back to summary |
|---|---|
| public void setSplitAtPage(int split) 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 two then each document would contain 2 pages. If the source document had 5 pages it would split into 3 new documents, 2 documents containing 2 pages and 1 document containing one page.
| |
| setStartPage | back to summary |
|---|---|
| public void setStartPage(int start) This will set the start page.
| |
| setStreamCacheCreateFunction | back to summary |
|---|---|
| public void setStreamCacheCreateFunction(RandomAccessStreamCache. Set the current function to be used to create an instance of stream cache.
| |
| split | back to summary |
|---|---|
| public List This will take a document and split into several other documents.
| |
| splitAtPage | back to summary |
|---|---|
| protected boolean splitAtPage(int pageNumber) Check if it is necessary to create a new document.
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.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv PDPageTree |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private COSBase | |
| pack-priv COSBase | Returns: a clone, or null if source is null or if there is no clone because it belongs to a different page or to no page.source dictionary or array. src, COSBase for the /P entry; parameter needed because arrays don't keep a parent. dstParent, COSDictionary used to remember whether we have a page parent somewhere or not.
Starts with null. currentPageDict)Creates a clone of the source. |
| private COSBase | |
| private void | removePossibleOrphanAnnotation(COSDictionary srcObj, COSDictionary srcDict, COSDictionary currentPageDict, COSDictionary dstDict)
|
| dstPageTree | back to summary |
|---|---|
| pack-priv PDPageTree dstPageTree | |
| KCloner | back to summary |
|---|---|
| public KCloner(PDPageTree dstPageTree) | |
| createArrayClone | back to summary |
|---|---|
| private COSBase createArrayClone(COSBase src, COSBase dstParent, COSDictionary currentPageDict) | |
| createClone | back to summary |
|---|---|
| pack-priv COSBase createClone(COSBase src, COSBase dstParent, COSDictionary currentPageDict) Creates a clone of the source.
| |
| createDictionaryClone | back to summary |
|---|---|
| private COSBase createDictionaryClone(COSBase src, COSBase dstParent, COSDictionary currentPageDict) | |
| removePossibleOrphanAnnotation | back to summary |
|---|---|
| private void removePossibleOrphanAnnotation(COSDictionary srcObj, COSDictionary srcDict, COSDictionary currentPageDict, COSDictionary dstDict) | |