Class PreflightStreamEngine

java.lang.Object
org.apache.pdfbox.contentstream.PDFStreamEngine
org.apache.pdfbox.preflight.content.PreflightStreamEngine
Direct Known Subclasses:
PreflightContentStream, PreflightType3Stream

public abstract class PreflightStreamEngine extends PDFStreamEngine
This class inherits from org.apache.pdfbox.util.PDFStreamEngine to allow the validation of specific rules in ContentStream.
  • Field Details

  • Constructor Details

  • Method Details

    • validateRenderingIntent

      protected void validateRenderingIntent(Operator operator, List<COSBase> arguments) throws ContentStreamException
      Check operands of the "ri" operator. Operands must exist in the RenderingIntent list. (org.apache.pdfbox.preflight.utils.RenderingIntents)
      Parameters:
      operator - the "ri" operator
      arguments - the "ri" operands
      Throws:
      ContentStreamException - ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY if the operand is invalid
    • validateNumberOfGraphicStates

      protected void validateNumberOfGraphicStates(Operator operator) throws ContentStreamException
      Valid the number of graphic states if the operator is the Save Graphic state operator ("q")
      Parameters:
      operator -
      Throws:
      ContentStreamException
    • validateInlineImageFilter

      protected void validateInlineImageFilter(Operator operator) throws ContentStreamException
      Throw a ContentStreamException if the LZW filter is used in a InlinedImage.
      Parameters:
      operator - the InlinedImage object (BI to EI)
      Throws:
      ContentStreamException
    • validateInlineImageColorSpace

      protected void validateInlineImageColorSpace(Operator operator) throws IOException
      This method validates if the ColorSpace used by the InlinedImage is consistent with the color space defined in OutputIntent dictionaries.
      Parameters:
      operator - the InlinedImage object (BI to EI)
      Throws:
      IOException
    • getColorSpaceHelper

      private ColorSpaceHelper getColorSpaceHelper(PDColorSpace pdCS)
    • toLongName

      private COSBase toLongName(COSBase cs)
    • checkColorOperators

      protected void checkColorOperators(String operation) throws ContentStreamException
      This method validates if the ColorOperator can be used with the color space defined in OutputIntent dictionaries.
      Parameters:
      operation - the color operator
      Throws:
      ContentStreamException
    • validateDefaultColorSpace

      void validateDefaultColorSpace(Operator operator) throws ContentStreamException
      In some cases, the colorspace isn't checked because defaults (/DeviceGray) is used. Thus we need to check all text output, stroke and fill for /DeviceGray.
      Parameters:
      operator - an operator.
      Throws:
      ContentStreamException
    • validColorSpace

      private boolean validColorSpace(PDColorSpace colorSpace, PreflightStreamEngine.ColorSpaceType expectedIccType) throws ContentStreamException
      Throws:
      ContentStreamException
    • validColorSpaceDestOutputProfile

      private boolean validColorSpaceDestOutputProfile(PreflightStreamEngine.ColorSpaceType expectedType) throws ContentStreamException
      Throws:
      ContentStreamException
    • isDeviceIndependent

      private boolean isDeviceIndependent(PDColorSpace cs, PreflightStreamEngine.ColorSpaceType expectedIccType)
    • getColorSpace

      private PDColorSpace getColorSpace(String operation)
    • checkSetColorSpaceOperators

      protected void checkSetColorSpaceOperators(Operator operator, List<COSBase> arguments) throws IOException
      This method validates if the ColorSpace used as operand is consistent with the color space defined in OutputIntent dictionaries.
      Parameters:
      operator -
      arguments -
      Throws:
      IOException
    • registerError

      protected void registerError(String msg, String errorCode)
      Add a validation error into the PreflightContext
      Parameters:
      msg - exception details
      errorCode - the error code.
    • registerError

      public void registerError(String msg, String errorCode, Throwable cause)
    • registerError

      protected void registerError(String msg, String errorCode, boolean warning)
    • registerError

      public void registerError(String msg, String errorCode, boolean warning, Throwable cause)