Class AbstractXObjValidator

java.lang.Object
org.apache.pdfbox.preflight.xobject.AbstractXObjValidator
All Implemented Interfaces:
XObjectValidator
Direct Known Subclasses:
XObjFormValidator, XObjImageValidator, XObjPostscriptValidator

public abstract class AbstractXObjValidator extends Object implements XObjectValidator
This class processes commons validations of XObjects.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The validation context which contains useful information to process validation.
    protected org.apache.pdfbox.cos.COSStream
    The XObject to validate as a COSStream.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractXObjValidator(PreflightContext context, org.apache.pdfbox.cos.COSStream xobj)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract void
    This method checks if required fields are present.
    protected void
    According the ISO 190005:1-2005 specification, a XObject can't have an OPI entry in its dictionary.
    protected void
    According the ISO 190005:1-2005 specification, PostScript XObjects are forbidden.
    protected void
    According the ISO 190005:1-2005 specification, a XObject can't have an Ref entry in its dictionary.
    protected void
    This method checks the SMask entry in the XObject dictionary.
    void
    Process the validation of the XObject.

    Methods inherited from class Object

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

    • xobject

      protected org.apache.pdfbox.cos.COSStream xobject
      The XObject to validate as a COSStream.
    • context

      protected PreflightContext context
      The validation context which contains useful information to process validation.
  • Constructor Details

    • AbstractXObjValidator

      public AbstractXObjValidator(PreflightContext context, org.apache.pdfbox.cos.COSStream xobj)
  • Method Details

    • checkSMask

      protected void checkSMask()
      This method checks the SMask entry in the XObject dictionary. According to the PDF Reference, a SMask in a XObject is a Stream. So if it is not null, it should be an error but a SMask with the name None is authorized in the PDF/A Specification 6.4. If the validation fails (SMask not null and different from None), the error list is updated with the error code ERROR_GRAPHIC_TRANSPARENCY_SMASK (2.2.2).
    • checkOPI

      protected void checkOPI()
      According the ISO 190005:1-2005 specification, a XObject can't have an OPI entry in its dictionary. If the XObject has a OPI entry, the error list is updated with the error code ERROR_GRAPHIC_UNEXPECTED_KEY (2.3).
    • checkReferenceXObject

      protected void checkReferenceXObject()
      According the ISO 190005:1-2005 specification, a XObject can't have an Ref entry in its dictionary. If the XObject has a Ref entry, the error list is updated with the error code ERROR_GRAPHIC_UNEXPECTED_KEY (2.3).
    • checkPostscriptXObject

      protected void checkPostscriptXObject()
      According the ISO 190005:1-2005 specification, PostScript XObjects are forbidden. If the XObject is a PostScript XObject, the error list is updated with the error code ERROR_GRAPHIC_UNEXPECTED_VALUE_FOR_KEY (2.3.2). To know whether the object is a Postscript XObject, "Subtype" and "Subtype2" entries are checked.
    • checkMandatoryFields

      protected abstract void checkMandatoryFields()
      This method checks if required fields are present.
    • validate

      public void validate() throws ValidationException
      Description copied from interface: XObjectValidator
      Process the validation of the XObject.
      Specified by:
      validate in interface XObjectValidator
      Throws:
      ValidationException