Package com.itextpdf.pdfoptimizer.util
Class DocumentStructureUtils
java.lang.Object
com.itextpdf.pdfoptimizer.util.DocumentStructureUtils
Util class for typical tasks across the whole structure of
PdfDocument
.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List
search
(com.itextpdf.kernel.pdf.PdfDocument document, IPdfObjectPredicate predicate) Collects all objects matches the provided predicate.static void
Goes across all the structure of the document starting from indirect objects definition and then through its children recursively.
-
Method Details
-
search
public static Listsearch (com.itextpdf.kernel.pdf.PdfDocument document, IPdfObjectPredicate predicate) Collects all objects matches the provided predicate.- Parameters:
-
document
- is aPdfDocument
to perform a search -
predicate
- is aIPdfObjectPredicate
- Returns:
- list of all indirect objects match the predicate
-
traverse
Goes across all the structure of the document starting from indirect objects definition and then through its children recursively. Every met indirect object definition is processed byIAction.processIndirectObjectDefinition(PdfObject)
and every met object including both types direct and indirect are is processed withIAction.processObject(PdfObject)
call. Allows to replace objects during traversing (seeIAction.processObject(PdfObject)
for details).- Parameters:
-
document
- is aPdfDocument
to perform a traversing -
action
- is an action to perform during traversing
-