Class PdfPagesTree
java.lang.Object
com.itextpdf.kernel.pdf.PdfPagesTree
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final intprivate final PdfDocumentprivate booleanprivate final intprivate static final org.slf4j.Loggerprivate ISimpleList<PdfIndirectReference> private ISimpleList<PdfPage> private PdfPages -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInsertsPdfPageinto specific one-based position.voidAppends the specifiedPdfPageto the end of this tree.protected voidprivate voidcorrectPdfPagesFromProperty(int index, int correction) private intfindPageParent(int pageNum) protected PdfPagesfindPageParent(PdfPage pdfPage) protected PdfObjectGenerate PdfPages tree.intGets total number of @see PdfPages.getPage(int pageNum) Returns thePdfPageat the specified position in this list.getPage(PdfDictionary pageDictionary) Returns thePdfPageby page's PdfDictionary.intgetPageNumber(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.intgetPageNumber(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 PdfPagesgetRoot()private booleaninternalRemovePage(int pageNum) private voidloadPage(int pageNum) private voidloadPage(int pageNum, Set<PdfIndirectReference> processedParents) Load page from pages tree node structure(package private) voidreleasePage(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- aPdfCatalogwhich will be used to create the tree
-
-
Method Details
-
getPage
-
getPage
Returns thePdfPageby page's PdfDictionary.- Parameters:
pageDictionary- page's PdfDictionary- Returns:
- the
PdfPageobject, 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
-
addPage
-
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)
-