Class ResourceDictionaryCleaner

java.lang.Object
org.sejda.impl.sambox.component.optimization.ResourceDictionaryCleaner
All Implemented Interfaces:
Consumer<org.sejda.sambox.pdmodel.PDDocument>

public class ResourceDictionaryCleaner extends Object implements Consumer<org.sejda.sambox.pdmodel.PDDocument>
Component that walks through the page tree, finds resource dictionaries and removes any image xobject (type xobject, subtype image) that is not wrapped by a ReadOnlyFilteredCOSStream and any font or extgstate that is not wrapped by a InUseDictionary. This is the step performed after pages content streams have been already parsed, every used image wrapped by a ReadOnlyFilteredCOSStream and every used fonts or extgstete wrapped by a InUseDictionary and placed back to the resources dictionary. This is done in two steps because dictionaries can be shared/inherited by pages so we can't take a single page, identify used images and remove the remaining because that same resource dictionary can be used by other pages.
Author:
Andrea Vacondio
  • Constructor Details

    • ResourceDictionaryCleaner

      public ResourceDictionaryCleaner()
  • Method Details

    • accept

      public void accept(org.sejda.sambox.pdmodel.PDDocument p)
      Specified by:
      accept in interface Consumer<org.sejda.sambox.pdmodel.PDDocument>
    • clean

      public void clean(org.sejda.sambox.pdmodel.PDPage page)