Class BookmarkValidationProcess

java.lang.Object
org.apache.pdfbox.preflight.process.AbstractProcess
org.apache.pdfbox.preflight.process.BookmarkValidationProcess
All Implemented Interfaces:
ValidationProcess

public class BookmarkValidationProcess extends AbstractProcess
  • Constructor Details

    • BookmarkValidationProcess

      public BookmarkValidationProcess()
  • Method Details

    • validate

      public void validate(PreflightContext ctx) throws ValidationException
      Throws:
      ValidationException
    • isCountEntryPresent

      private boolean isCountEntryPresent(COSDictionary outline)
      Return true if the Count entry is present in the given dictionary.
      Parameters:
      outline - the dictionary representing the document outline.
      Returns:
      true if the Count entry is present.
    • isCountEntryPositive

      private boolean isCountEntryPositive(PreflightContext ctx, COSDictionary outline)
      return true if Count entry > 0
      Parameters:
      ctx - the preflight context.
      outline - the dictionary representing the document outline.
      Returns:
      true if the Count entry > 0.
    • exploreOutlineLevel

      protected boolean exploreOutlineLevel(PreflightContext ctx, PDOutlineItem inputItem, COSObject firstObj, COSObject lastObj) throws ValidationException
      This method explores the Outline Item Level and calls a validation method on each Outline Item. If an invalid outline item is found, the result list is updated.
      Parameters:
      ctx - the preflight context.
      inputItem - The first outline item of the level.
      firstObj - The first PDF object of the level.
      lastObj - The last PDF object of the level.
      Returns:
      true if all items are valid in this level.
      Throws:
      ValidationException
    • validateItem

      protected boolean validateItem(PreflightContext ctx, PDOutlineItem inputItem) throws ValidationException
      This method checks the inputItem dictionary and call the exploreOutlineLevel method on the first child if it is not null.
      Parameters:
      ctx - the preflight context.
      inputItem - outline item to validate
      Returns:
      the validation result.
      Throws:
      ValidationException
    • checkIndirectObjects

      private boolean checkIndirectObjects(PreflightContext ctx, COSDictionary dictionary)
    • checkIndirectObject

      private boolean checkIndirectObject(PreflightContext ctx, COSDictionary dictionary, COSName name)
    • toCOSObject

      private COSObject toCOSObject(COSBase base)
      Returns a COSBase as a COSObject or null if null or COSNull. To avoid trouble, this method is to be called only after having called checkIndirectObjects(PreflightContext, COSDictionary).
      Parameters:
      base - should be null, COSNull or a COSObject.
      Returns:
      null if the parameter is COSNull or null; or else a COSObject.
      Throws:
      IllegalArgumentException - if the parameter is not null, COSNull or a COSObject.