Class DocumentStructureUtils

java.lang.Object
com.itextpdf.pdfoptimizer.util.DocumentStructureUtils

public final class DocumentStructureUtils extends Object
Util class for typical tasks across the whole structure of PdfDocument.
  • Method Summary

    Modifier and Type
    Method
    Description
    static List
    search(com.itextpdf.kernel.pdf.PdfDocument document, IPdfObjectPredicate predicate)
    Collects all objects matches the provided predicate.
    static void
    traverse(com.itextpdf.kernel.pdf.PdfDocument document, IAction action)
    Goes across all the structure of the document starting from indirect objects definition and then through its children recursively.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • search

      public static List search (com.itextpdf.kernel.pdf.PdfDocument document, IPdfObjectPredicate predicate)
      Collects all objects matches the provided predicate.
      Parameters:
      document - is a PdfDocument to perform a search
      predicate - is a IPdfObjectPredicate
      Returns:
      list of all indirect objects match the predicate
    • traverse

      public static void traverse (com.itextpdf.kernel.pdf.PdfDocument document, IAction action)
      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 by IAction.processIndirectObjectDefinition(PdfObject) and every met object including both types direct and indirect are is processed with IAction.processObject(PdfObject) call. Allows to replace objects during traversing (see IAction.processObject(PdfObject) for details).
      Parameters:
      document - is a PdfDocument to perform a traversing
      action - is an action to perform during traversing