Package com.itextpdf.kernel.pdf
Class PdfPagesTree
java.lang.Object
com.itextpdf.kernel.pdf.PdfPagesTree
Algorithm for construction
PdfPages
tree-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
private final PdfDocument
private boolean
private final int
private static final org.slf4j.Logger
private ISimpleList
<PdfIndirectReference> private ISimpleList
<PdfPage> private PdfPages
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
InsertsPdfPage
into specific one-based position.void
Appends the specifiedPdfPage
to the end of this tree.protected void
private void
correctPdfPagesFromProperty
(int index, int correction) private int
findPageParent
(int pageNum) protected PdfPages
findPageParent
(PdfPage pdfPage) protected PdfObject
Generate PdfPages tree.int
Gets total number of @see PdfPages.getPage
(int pageNum) Returns thePdfPage
at the specified position in this list.getPage
(PdfDictionary pageDictionary) Returns thePdfPage
by page's PdfDictionary.int
getPageNumber
(PdfDictionary pageDictionary) Returns the index of the first occurrence of the page in this tree specified by it's PdfDictionary, or 0 if this tree does not contain the page.int
getPageNumber
(PdfPage page) Returns the index of the first occurrence of the specified page in this tree, or 0 if this tree does not contain the page.protected PdfPages
getRoot()
private boolean
internalRemovePage
(int pageNum) private void
loadPage
(int pageNum) private void
loadPage
(int pageNum, Set<PdfIndirectReference> processedParents) Load page from pages tree node structure(package private) void
releasePage
(int pageNumber) removePage
(int pageNum) Removes the page at the specified position in this tree.
-
Field Details
-
DEFAULT_LEAF_SIZE
static final int DEFAULT_LEAF_SIZE- See Also:
-
leafSize
private final int leafSize- See Also:
-
pageRefs
-
parents
-
pages
-
document
-
generated
private boolean generated -
root
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
-
Constructor Details
-
PdfPagesTree
Creates a PdfPages tree.- Parameters:
pdfCatalog
- aPdfCatalog
which will be used to create the tree
-
-
Method Details
-
getPage
Returns thePdfPage
at the specified position in this list.- Parameters:
pageNum
- one-based index of the element to return- Returns:
- the
PdfPage
at the specified position in this list
-
getPage
Returns thePdfPage
by page's PdfDictionary.- Parameters:
pageDictionary
- page's PdfDictionary- Returns:
- the
PdfPage
object, that wrapspageDictionary
.
-
getNumberOfPages
public int getNumberOfPages()Gets total number of @see PdfPages.- Returns:
- total number of pages
-
getPageNumber
Returns the index of the first occurrence of the specified page in this tree, or 0 if this tree does not contain the page. -
getPageNumber
Returns the index of the first occurrence of the page in this tree specified by it's PdfDictionary, or 0 if this tree does not contain the page. -
addPage
Appends the specifiedPdfPage
to the end of this tree.- Parameters:
pdfPage
- aPdfPage
to be added
-
addPage
InsertsPdfPage
into specific one-based position.- Parameters:
index
- one-base index of the pagepdfPage
-PdfPage
to insert.
-
removePage
Removes the page at the specified position in this tree. Shifts any subsequent elements to the left (subtracts one from their indices).- Parameters:
pageNum
- the one-based index of the PdfPage to be removed- Returns:
- the page that was removed from the list
-
releasePage
void releasePage(int pageNumber) -
generateTree
Generate PdfPages tree.- Returns:
- root
PdfPages
- Throws:
PdfException
- in case empty document
-
clearPageRefs
protected void clearPageRefs() -
getParents
-
getRoot
-
findPageParent
-
loadPage
private void loadPage(int pageNum) -
loadPage
Load page from pages tree node structure- Parameters:
pageNum
- page number to loadprocessedParents
- set with already processed parents object reference numbers if this method was called recursively to avoid infinite recursion.
-
internalRemovePage
private boolean internalRemovePage(int pageNum) -
findPageParent
private int findPageParent(int pageNum) -
correctPdfPagesFromProperty
private void correctPdfPagesFromProperty(int index, int correction)
-