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 java.lang.Object implements XObjectValidator
This class processes commons validations of XObjects.
-
-
Field Summary
Fields Modifier and Type Field Description protected PreflightContextcontextThe validation context which contains useful information to process validation.protected COSStreamxobjectThe XObject to validate as a COSStream.
-
Constructor Summary
Constructors Constructor Description AbstractXObjValidator(PreflightContext context, COSStream xobj)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcheckMandatoryFields()This method checks if required fields are present.protected voidcheckOPI()According the ISO 190005:1-2005 specification, a XObject can't have an OPI entry in its dictionary.protected voidcheckPostscriptXObject()According the ISO 190005:1-2005 specification, PostScript XObjects are forbidden.protected voidcheckReferenceXObject()According the ISO 190005:1-2005 specification, a XObject can't have an Ref entry in its dictionary.protected voidcheckSMask()This method checks the SMask entry in the XObject dictionary.voidvalidate()Process the validation of the XObject.
-
-
-
Field Detail
-
xobject
protected COSStream xobject
The XObject to validate as a COSStream.
-
context
protected PreflightContext context
The validation context which contains useful information to process validation.
-
-
Constructor Detail
-
AbstractXObjValidator
public AbstractXObjValidator(PreflightContext context, COSStream xobj)
-
-
Method Detail
-
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 ValidationExceptionDescription copied from interface:XObjectValidatorProcess the validation of the XObject.- Specified by:
validatein interfaceXObjectValidator- Throws:
ValidationException
-
-