public class PdfSplitter extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
PdfSplitter.IDocumentReadyListener |
Constructor and Description |
---|
PdfSplitter(PdfDocument pdfDocument)
Creates a new instance of PdfSplitter class.
|
Modifier and Type | Method and Description |
---|---|
PdfDocument |
extractPageRange(PageRange pageRange)
Extracts the specified page ranges from a document.
|
List<PdfDocument> |
extractPageRanges(List<PageRange> pageRanges)
Extracts the specified page ranges from a document.
|
protected PdfWriter |
getNextPdfWriter(PageRange documentPageRange)
This method is called when another split document is to be created.
|
PdfDocument |
getPdfDocument() |
void |
setEventCountingMetaInfo(IMetaInfo metaInfo)
Sets the IMetaInfo that will be used during PdfDocument creation.
|
void |
setPreserveOutlines(boolean preserveOutlines)
If original document has outlines, then by default all resultant document will also have outlines.
|
void |
setPreserveTagged(boolean preserveTagged)
If original document is tagged, then by default all resultant document will also be tagged.
|
List<PdfDocument> |
splitByOutlines(List<String> outlineTitles)
Split a document by outline title (bookmark name), find outline by name and places the entire hierarchy in a separate document ( outlines and pages ) .
|
List<PdfDocument> |
splitByPageCount(int pageCount)
Splits a document into smaller documents with no more than @pageCount pages each.
|
void |
splitByPageCount(int pageCount, PdfSplitter.IDocumentReadyListener documentReady)
Splits a document into smaller documents with no more than @pageCount pages each.
|
List<PdfDocument> |
splitByPageNumbers(List<Integer> pageNumbers)
Splits the document by page numbers.
|
void |
splitByPageNumbers(List<Integer> pageNumbers, PdfSplitter.IDocumentReadyListener documentReady)
Splits the document by page numbers.
|
List<PdfDocument> |
splitBySize(long size)
Splits the document basing on the given size.
|
public PdfSplitter(PdfDocument pdfDocument)
pdfDocument
- the document to be split.
public void setEventCountingMetaInfo(IMetaInfo metaInfo)
IMetaInfo
that will be used during PdfDocument
creation.
metaInfo
- meta info to set
public void setPreserveTagged(boolean preserveTagged)
preserveTagged
- defines whether the resultant documents need to be tagged
public void setPreserveOutlines(boolean preserveOutlines)
preserveOutlines
- defines whether the resultant documents will preserve outlines or not
public List<PdfDocument> splitBySize(long size)
size
- Preferred size for splitting.
public void splitByPageNumbers(List<Integer> pageNumbers, PdfSplitter.IDocumentReadyListener documentReady)
pageNumbers
- the numbers of pages from which another document is to be started. If the first element is not 1, then 1 is implied (i.e. the first split document will start from page 1 in any case).
documentReady
- the event listener which is called when another document is ready. You can close this document in this listener, for instance.
public List<PdfDocument> splitByPageNumbers(List<Integer> pageNumbers)
pageNumbers
- the numbers of pages from which another document is to be started. If the first element is not 1, then 1 is implied (i.e. the first split document will start from page 1 in any case).
public void splitByPageCount(int pageCount, PdfSplitter.IDocumentReadyListener documentReady)
pageCount
- the biggest possible number of pages in a split document.
documentReady
- the event listener which is called when another document is ready. You can close this document in this listener, for instance.
public List<PdfDocument> splitByPageCount(int pageCount)
pageCount
- the biggest possible number of pages in a split document.
public List<PdfDocument> extractPageRanges(List<PageRange> pageRanges)
pageRanges
- the list of page ranges for each of the resultant document.
public PdfDocument extractPageRange(PageRange pageRange)
pageRange
- the page range to be extracted from the document.
public PdfDocument getPdfDocument()
protected PdfWriter getNextPdfWriter(PageRange documentPageRange)
PdfWriter
depending on your needs.
documentPageRange
- the page range of the original document to be included in the document being created now.
public List<PdfDocument> splitByOutlines(List<String> outlineTitles)
outlineTitles
- list of outline titles .
PdfDocument
which contains split parts of a document
Copyright © 1998–2023 iText Group NV. All rights reserved.