Class FontDuplicationOptimizer


public class FontDuplicationOptimizer extends AbstractOptimizationHandler
Looks for font dictionary duplications and merged them.
  • Constructor Details

    • FontDuplicationOptimizer

      public FontDuplicationOptimizer()
  • Method Details

    • optimizePdf

      protected void optimizePdf (com.itextpdf.kernel.pdf.PdfDocument document, OptimizationSession session)
      The method searches for font dictionaries in PdfDocuments and compare them. If two dictionaries are similar and can be merged into one then optimizer does it and replace all old pdf dictionaries. Duplicated direct objects will be removed. Definitions of indirect objects will be left, however if PdfDocument.isFlushUnusedObjects() returns false then they will be ignored during flushing.
      Specified by:
      optimizePdf in class AbstractOptimizationHandler
      document - is the PDF document to optimize. Invocation of the method can change the state of the object
      session - is an auxiliary object used to support share data between stages of optimization process