Package com.itextpdf.pdfa.checker
Class PdfA2Checker
- java.lang.Object
-
- com.itextpdf.pdfa.checker.PdfAChecker
-
- com.itextpdf.pdfa.checker.PdfA1Checker
-
- com.itextpdf.pdfa.checker.PdfA2Checker
-
- All Implemented Interfaces:
IValidationChecker
- Direct Known Subclasses:
PdfA3Checker
public class PdfA2Checker extends PdfA1Checker
PdfA2Checker defines the requirements of the PDF/A-2 standard and contains a number of methods that override the implementations of its superclassPdfA1Checker
.The specification implemented by this class is ISO 19005-2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
PdfA2Checker.UpdateCanvasGraphicsState
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Set<PdfName>
allowedBlendModes
protected static java.util.Set<PdfName>
allowedFilters
protected static java.util.Set<PdfName>
allowedInlineImageFilters
protected static java.util.Set<PdfName>
apLessAnnotations
private boolean
currentFillCsIsIccBasedCMYK
private boolean
currentStrokeCsIsIccBasedCMYK
protected static java.util.Set<PdfName>
forbiddenActions
protected static java.util.Set<PdfName>
forbiddenAnnotations
private static org.slf4j.Logger
logger
private static int
MAX_NUMBER_OF_DEVICEN_COLOR_COMPONENTS
(package private) static int
MAX_PAGE_SIZE
(package private) static int
MIN_PAGE_SIZE
private java.util.Map<PdfName,PdfArray>
separationColorSpaces
private static java.lang.String
TRANSPARENCY_ERROR_MESSAGE
protected java.util.Set<PdfObject>
transparencyObjects
-
Fields inherited from class com.itextpdf.pdfa.checker.PdfA1Checker
allowedNamedActions, allowedRenderingIntents, contentAnnotations
-
Fields inherited from class com.itextpdf.pdfa.checker.PdfAChecker
checkedObjects, checkedObjectsColorspace, cmykUsedObjects, conformance, grayUsedObjects, gsStackDepth, ICC_COLOR_SPACE_CMYK, ICC_COLOR_SPACE_GRAY, ICC_COLOR_SPACE_RGB, ICC_DEVICE_CLASS_MONITOR_PROFILE, ICC_DEVICE_CLASS_OUTPUT_PROFILE, maxGsStackDepth, pdfAOutputIntentColorSpace, pdfAOutputIntentDestProfile, rgbUsedObjects
-
-
Constructor Summary
Constructors Constructor Description PdfA2Checker(PdfAConformance aConformance)
Creates a PdfA2Checker with the required conformance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkAnnotation(PdfDictionary annotDic)
Verify the conformity of the annotation dictionary.protected void
checkAnnotationAgainstActions(PdfDictionary annotDic)
Checked annotation against actions, exception will be thrown if eitherA
orAA
actions aren't allowed for specific type of annotation.(package private) void
checkAnnotationsForTransparency(PdfArray annotations)
protected void
checkAppearanceStream(PdfStream appearanceStream)
Check single annotation appearance stream.private void
checkAppearanceStreamForTransparency(PdfDictionary ap, java.util.Set<PdfObject> checkedObjects)
protected void
checkBlendMode(PdfName blendMode)
Check if blendMode is compatible with pdf/a standard being used.protected void
checkCatalogAAConformance(PdfDictionary dict)
Checks if the catalog is compliant with the PDF/A-2 standard.private void
checkCatalogConfig(PdfDictionary config, java.util.HashSet<PdfObject> ocgs, java.util.HashSet<java.lang.String> names)
protected void
checkCatalogValidEntries(PdfDictionary catalogDict)
Checks if entries in catalog dictionary are valid.void
checkColor(CanvasGraphicsState gState, Color color, PdfDictionary currentColorSpaces, java.lang.Boolean fill, PdfStream contentStream)
This method checks compliance with the color restrictions imposed by the available color spaces in the document.void
checkColorSpace(PdfColorSpace colorSpace, PdfObject pdfObject, PdfDictionary currentColorSpaces, boolean checkAlternate, java.lang.Boolean fill)
This method performs a range of checks on the given color space, depending on the type and properties of that color space.protected void
checkContentConfigurationDictAgainstAsKey(PdfDictionary config)
Check optional content configuration dictionary against AS key.(package private) void
checkContentsForTransparency(PdfDictionary pageDict)
private boolean
checkDefaultCS(PdfObject pdfObject, PdfDictionary currentColorSpaces, java.lang.Boolean fill, PdfName defaultCsName, int numOfComponents)
void
checkExtGState(CanvasGraphicsState extGState, PdfStream contentStream)
Performs a number of checks on the graphics state, among others ISO 19005-1 section 6.2.8 and 6.4 and ISO 19005-2 section 6.2.5 and 6.2.10.protected void
checkFileSpec(PdfDictionary fileSpec)
Verify the conformity of the file specification dictionary.void
checkFontGlyphs(PdfFont font, PdfStream contentStream)
Performs a check of the each font glyph as a Form XObject.protected void
checkForm(PdfDictionary form)
Verify the conformity of the form dictionary.protected void
checkFormXObject(PdfStream form)
For pdf/a-2+ checkers this method is overridden to usecheckFormXObject(PdfStream form, PdfStream contentStream)
method.protected void
checkFormXObject(PdfStream form, PdfStream contentStream)
Verify the conformity of the Form XObject with appropriate specification.protected void
checkImage(PdfStream image, PdfDictionary currentColorSpaces)
Verify the conformity of the given image.void
checkInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces)
This method checks compliance with the inline image restrictions in the PDF/A specs, specifically filter parameters.protected void
checkNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
Verify the conformity of the non-symbolic TrueType font.protected void
checkNumberOfDeviceNComponents(PdfSpecialCs.DeviceN deviceN)
private void
checkObjectWithResourcesForTransparency(PdfObject objectWithResources, java.util.Set<PdfObject> checkedObjects)
private void
checkOCProperties(PdfDictionary oCProperties)
protected void
checkOutputIntents(PdfDictionary catalog)
Verify the conformity of the output intents array in the catalog dictionary.protected void
checkPageAAConformance(PdfDictionary dict)
Checks if the page is compliant with the PDF/A-2 standard.protected void
checkPageColorsUsages(PdfDictionary pageDict, PdfDictionary pageResources)
Verify the conformity of used color spaces on the page.protected void
checkPageObject(PdfDictionary pageDict, PdfDictionary pageResources)
Verify the conformity of the page dictionary.protected void
checkPageSize(PdfDictionary page)
Checks the allowable size of the page.protected void
checkPageTransparency(PdfDictionary pageDict, PdfDictionary pageResources)
Verify the conformity of the page transparency.protected void
checkPdfArray(PdfArray array)
Verify the conformity of the PDF array.protected void
checkPdfDictionary(PdfDictionary dictionary)
Verify the conformity of the PDF dictionary.protected void
checkPdfStream(PdfStream stream)
Verify the conformity of the PDF stream.(package private) void
checkResourcesForTransparency(PdfDictionary resources, java.util.Set<PdfObject> checkedObjects)
private void
checkSeparationCS(PdfArray separation)
private void
checkSeparationInsideDeviceN(PdfArray separation, PdfObject deviceNColorSpace, PdfObject deviceNTintTransform)
void
checkSignature(PdfDictionary signatureDict)
This method checks compliance of the signature dictionaryprivate void
checkSingleResourceTypeForTransparency(PdfDictionary singleResourceDict, java.util.Set<PdfObject> checkedObjects)
protected void
checkTransparencyGroup(PdfStream form, PdfStream contentStream)
Verify the conformity of the transparency group XObject with appropriate specification.private void
checkType3FontGlyphs(PdfType3Font font, PdfStream contentStream)
private void
fillOrderRecursively(PdfArray orderArray, java.util.Set<PdfObject> order)
protected java.util.Set<PdfName>
getAllowedNamedActions()
Retrieve allowed actions in conforming document.protected java.util.Set<PdfName>
getAppearanceLessAnnotations()
Gets annotation types which are allowed not to have appearance stream.protected java.util.Set<PdfName>
getForbiddenActions()
Retrieve forbidden actions in conforming document.protected java.util.Set<PdfName>
getForbiddenAnnotations()
Gets forbidden annotation types.protected double
getMaxRealValue()
Retrieve maximum allowed real value.protected int
getMaxStringLength()
Returns maximum allowed bytes length of the string in a PDF document.protected java.lang.String
getTransparencyErrorMessage()
Retrieve transparency error message valid for the pdf/a standard being used.private boolean
isAltCSIsTheSame(PdfObject cs1, PdfObject cs2)
-
Methods inherited from class com.itextpdf.pdfa.checker.PdfA1Checker
checkAction, checkCanvasStack, checkCatalog, checkContentStream, checkCrypto, checkFont, checkLogicalStructure, checkMetaData, checkPdfName, checkPdfNumber, checkPdfString, checkRenderingIntent, checkSignatureType, checkSymbolicTrueTypeFont, checkText, checkTrailer, checkXrefTable, getFormFields, getMaxIntegerValue, getMaxNameLength, getMaxNumberOfIndirectObjects, getMinIntegerValue
-
Methods inherited from class com.itextpdf.pdfa.checker.PdfAChecker
checkContentStreamObject, checkDocument, checkFlag, checkPdfObject, checkResources, checkResourcesOfAppearanceStreams, checkSinglePage, checkStructure, checkTagStructureElement, getAConformance, getPdfAOutputIntent, isAlreadyChecked, isContainsTransparencyGroup, isFullCheckMode, isPdfObjectReadyToFlush, setFullCheckMode, setPdfAOutputIntentColorSpace, validate
-
-
-
-
Field Detail
-
forbiddenAnnotations
protected static final java.util.Set<PdfName> forbiddenAnnotations
-
apLessAnnotations
protected static final java.util.Set<PdfName> apLessAnnotations
-
forbiddenActions
protected static final java.util.Set<PdfName> forbiddenActions
-
allowedBlendModes
protected static final java.util.Set<PdfName> allowedBlendModes
-
allowedFilters
protected static final java.util.Set<PdfName> allowedFilters
-
allowedInlineImageFilters
protected static final java.util.Set<PdfName> allowedInlineImageFilters
-
transparencyObjects
protected java.util.Set<PdfObject> transparencyObjects
-
MAX_PAGE_SIZE
static final int MAX_PAGE_SIZE
- See Also:
- Constant Field Values
-
MIN_PAGE_SIZE
static final int MIN_PAGE_SIZE
- See Also:
- Constant Field Values
-
MAX_NUMBER_OF_DEVICEN_COLOR_COMPONENTS
private static final int MAX_NUMBER_OF_DEVICEN_COLOR_COMPONENTS
- See Also:
- Constant Field Values
-
logger
private static final org.slf4j.Logger logger
-
TRANSPARENCY_ERROR_MESSAGE
private static final java.lang.String TRANSPARENCY_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
currentFillCsIsIccBasedCMYK
private boolean currentFillCsIsIccBasedCMYK
-
currentStrokeCsIsIccBasedCMYK
private boolean currentStrokeCsIsIccBasedCMYK
-
-
Constructor Detail
-
PdfA2Checker
public PdfA2Checker(PdfAConformance aConformance)
Creates a PdfA2Checker with the required conformance- Parameters:
aConformance
- the required conformance,a
oru
orb
-
-
Method Detail
-
checkInlineImage
public void checkInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces)
Description copied from class:PdfAChecker
This method checks compliance with the inline image restrictions in the PDF/A specs, specifically filter parameters.- Overrides:
checkInlineImage
in classPdfA1Checker
- Parameters:
inlineImage
- aPdfStream
containing the inline imagecurrentColorSpaces
- aPdfDictionary
containing the color spaces used in the document
-
checkColor
public void checkColor(CanvasGraphicsState gState, Color color, PdfDictionary currentColorSpaces, java.lang.Boolean fill, PdfStream contentStream)
This method checks compliance with the color restrictions imposed by the available color spaces in the document.- Overrides:
checkColor
in classPdfA1Checker
- Parameters:
gState
- canvas graphics statecolor
- the color to checkcurrentColorSpaces
- aPdfDictionary
containing the color spaces used in the documentfill
- whether the color is used for fill or stroke operationscontentStream
- current content stream
-
checkColorSpace
public void checkColorSpace(PdfColorSpace colorSpace, PdfObject pdfObject, PdfDictionary currentColorSpaces, boolean checkAlternate, java.lang.Boolean fill)
This method performs a range of checks on the given color space, depending on the type and properties of that color space.- Overrides:
checkColorSpace
in classPdfA1Checker
- Parameters:
colorSpace
- the color space to checkpdfObject
- the pdf object to check color space incurrentColorSpaces
- aPdfDictionary
containing the color spaces used in the documentcheckAlternate
- whether or not to also check the parent color spacefill
- whether the color space is used for fill or stroke operations
-
checkExtGState
public void checkExtGState(CanvasGraphicsState extGState, PdfStream contentStream)
Description copied from class:PdfAChecker
Performs a number of checks on the graphics state, among others ISO 19005-1 section 6.2.8 and 6.4 and ISO 19005-2 section 6.2.5 and 6.2.10. This method will be abstract in the update 7.2- Overrides:
checkExtGState
in classPdfA1Checker
- Parameters:
extGState
- the graphics state to be checkedcontentStream
- current content stream
-
checkSignature
public void checkSignature(PdfDictionary signatureDict)
Description copied from class:PdfAChecker
This method checks compliance of the signature dictionary- Overrides:
checkSignature
in classPdfAChecker
- Parameters:
signatureDict
- aPdfDictionary
containing the signature.
-
checkNumberOfDeviceNComponents
protected void checkNumberOfDeviceNComponents(PdfSpecialCs.DeviceN deviceN)
-
checkNonSymbolicTrueTypeFont
protected void checkNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
Description copied from class:PdfAChecker
Verify the conformity of the non-symbolic TrueType font.- Overrides:
checkNonSymbolicTrueTypeFont
in classPdfA1Checker
- Parameters:
trueTypeFont
- thePdfTrueTypeFont
to check
-
getMaxRealValue
protected double getMaxRealValue()
Description copied from class:PdfA1Checker
Retrieve maximum allowed real value.- Overrides:
getMaxRealValue
in classPdfA1Checker
- Returns:
- maximum allowed real number
-
getMaxStringLength
protected int getMaxStringLength()
Description copied from class:PdfA1Checker
Returns maximum allowed bytes length of the string in a PDF document.- Overrides:
getMaxStringLength
in classPdfA1Checker
- Returns:
- maximum string length
-
checkPdfArray
protected void checkPdfArray(PdfArray array)
Description copied from class:PdfAChecker
Verify the conformity of the PDF array.- Overrides:
checkPdfArray
in classPdfA1Checker
- Parameters:
array
- thePdfArray
to check
-
checkPdfDictionary
protected void checkPdfDictionary(PdfDictionary dictionary)
Description copied from class:PdfAChecker
Verify the conformity of the PDF dictionary.- Overrides:
checkPdfDictionary
in classPdfA1Checker
- Parameters:
dictionary
- thePdfDictionary
to check
-
checkAnnotation
protected void checkAnnotation(PdfDictionary annotDic)
Verify the conformity of the annotation dictionary.- Overrides:
checkAnnotation
in classPdfA1Checker
- Parameters:
annotDic
- the annotationPdfDictionary
to be checked
-
getAppearanceLessAnnotations
protected java.util.Set<PdfName> getAppearanceLessAnnotations()
Gets annotation types which are allowed not to have appearance stream.- Returns:
- set of annotation names.
-
checkAnnotationAgainstActions
protected void checkAnnotationAgainstActions(PdfDictionary annotDic)
Checked annotation against actions, exception will be thrown if eitherA
orAA
actions aren't allowed for specific type of annotation.- Parameters:
annotDic
- an annotation PDF dictionary
-
getForbiddenAnnotations
protected java.util.Set<PdfName> getForbiddenAnnotations()
Gets forbidden annotation types.- Overrides:
getForbiddenAnnotations
in classPdfA1Checker
- Returns:
- a set of forbidden annotation types
-
checkAppearanceStream
protected void checkAppearanceStream(PdfStream appearanceStream)
Description copied from class:PdfAChecker
Check single annotation appearance stream.- Overrides:
checkAppearanceStream
in classPdfAChecker
- Parameters:
appearanceStream
- thePdfStream
to check
-
checkForm
protected void checkForm(PdfDictionary form)
Description copied from class:PdfAChecker
Verify the conformity of the form dictionary.- Overrides:
checkForm
in classPdfA1Checker
- Parameters:
form
- the formPdfDictionary
to be checked
-
checkCatalogAAConformance
protected void checkCatalogAAConformance(PdfDictionary dict)
Checks if the catalog is compliant with the PDF/A-2 standard.- Parameters:
dict
- the catalog dictionary
-
checkCatalogValidEntries
protected void checkCatalogValidEntries(PdfDictionary catalogDict)
Description copied from class:PdfAChecker
Checks if entries in catalog dictionary are valid.- Overrides:
checkCatalogValidEntries
in classPdfA1Checker
- Parameters:
catalogDict
- the catalogPdfDictionary
to be checked
-
checkPageSize
protected void checkPageSize(PdfDictionary page)
Description copied from class:PdfAChecker
Checks the allowable size of the page.- Overrides:
checkPageSize
in classPdfA1Checker
- Parameters:
page
- thePdfDictionary
of page which size being checked
-
checkFileSpec
protected void checkFileSpec(PdfDictionary fileSpec)
Description copied from class:PdfAChecker
Verify the conformity of the file specification dictionary.- Overrides:
checkFileSpec
in classPdfA1Checker
- Parameters:
fileSpec
- thePdfDictionary
containing file specification to be checked
-
checkPdfStream
protected void checkPdfStream(PdfStream stream)
Description copied from class:PdfAChecker
Verify the conformity of the PDF stream.- Overrides:
checkPdfStream
in classPdfA1Checker
- Parameters:
stream
- thePdfStream
to check
-
checkPageAAConformance
protected void checkPageAAConformance(PdfDictionary dict)
Checks if the page is compliant with the PDF/A-2 standard.- Parameters:
dict
- the page dictionary
-
checkPageObject
protected void checkPageObject(PdfDictionary pageDict, PdfDictionary pageResources)
Description copied from class:PdfAChecker
Verify the conformity of the page dictionary.- Overrides:
checkPageObject
in classPdfA1Checker
- Parameters:
pageDict
- thePdfDictionary
to checkpageResources
- the page's resources dictionary
-
checkPageTransparency
protected void checkPageTransparency(PdfDictionary pageDict, PdfDictionary pageResources)
Description copied from class:PdfAChecker
Verify the conformity of the page transparency.- Overrides:
checkPageTransparency
in classPdfA1Checker
- Parameters:
pageDict
- thePdfDictionary
contains contents for transparency to be checkedpageResources
- thePdfDictionary
contains resources for transparency to be checked
-
checkOutputIntents
protected void checkOutputIntents(PdfDictionary catalog)
Description copied from class:PdfAChecker
Verify the conformity of the output intents array in the catalog dictionary.- Overrides:
checkOutputIntents
in classPdfA1Checker
- Parameters:
catalog
- thePdfDictionary
of a catalog or page to check
-
getForbiddenActions
protected java.util.Set<PdfName> getForbiddenActions()
Description copied from class:PdfAChecker
Retrieve forbidden actions in conforming document.- Overrides:
getForbiddenActions
in classPdfA1Checker
- Returns:
- set of
PdfName
with forbidden actions
-
getAllowedNamedActions
protected java.util.Set<PdfName> getAllowedNamedActions()
Description copied from class:PdfAChecker
Retrieve allowed actions in conforming document.- Overrides:
getAllowedNamedActions
in classPdfA1Checker
- Returns:
- set of
PdfName
with allowed named actions
-
checkPageColorsUsages
protected void checkPageColorsUsages(PdfDictionary pageDict, PdfDictionary pageResources)
Verify the conformity of used color spaces on the page.- Overrides:
checkPageColorsUsages
in classPdfA1Checker
- Parameters:
pageDict
- thePdfDictionary
contains contents for colors to be checkedpageResources
- thePdfDictionary
contains resources for colors to be checked
-
checkOCProperties
private void checkOCProperties(PdfDictionary oCProperties)
-
checkImage
protected void checkImage(PdfStream image, PdfDictionary currentColorSpaces)
Description copied from class:PdfAChecker
Verify the conformity of the given image.- Overrides:
checkImage
in classPdfA1Checker
- Parameters:
image
- the image to checkcurrentColorSpaces
- thePdfDictionary
containing the color spaces used in the document
-
checkFontGlyphs
public void checkFontGlyphs(PdfFont font, PdfStream contentStream)
Description copied from class:PdfAChecker
Performs a check of the each font glyph as a Form XObject. See ISO 19005-2 Annex A.5. This only applies to type 3 fonts. This method will be abstract in update 7.2- Overrides:
checkFontGlyphs
in classPdfA1Checker
- Parameters:
font
-PdfFont
to be checkedcontentStream
- stream containing checked font
-
checkFormXObject
protected void checkFormXObject(PdfStream form)
For pdf/a-2+ checkers this method is overridden to usecheckFormXObject(PdfStream form, PdfStream contentStream)
method.- Overrides:
checkFormXObject
in classPdfA1Checker
- Parameters:
form
- thePdfStream
to check
-
checkFormXObject
protected void checkFormXObject(PdfStream form, PdfStream contentStream)
Verify the conformity of the Form XObject with appropriate specification. Throws PdfAConformanceException if any discrepancy was found
-
checkTransparencyGroup
protected void checkTransparencyGroup(PdfStream form, PdfStream contentStream)
Verify the conformity of the transparency group XObject with appropriate specification. Throws PdfAConformanceException if any discrepancy was found
-
checkContentConfigurationDictAgainstAsKey
protected void checkContentConfigurationDictAgainstAsKey(PdfDictionary config)
Check optional content configuration dictionary against AS key.- Parameters:
config
- a content configuration dictionary
-
getTransparencyErrorMessage
protected java.lang.String getTransparencyErrorMessage()
Retrieve transparency error message valid for the pdf/a standard being used.- Returns:
- error message.
-
checkBlendMode
protected void checkBlendMode(PdfName blendMode)
Check if blendMode is compatible with pdf/a standard being used.- Parameters:
blendMode
- blend mode name to check.
-
checkContentsForTransparency
void checkContentsForTransparency(PdfDictionary pageDict)
-
checkAnnotationsForTransparency
void checkAnnotationsForTransparency(PdfArray annotations)
-
checkAppearanceStreamForTransparency
private void checkAppearanceStreamForTransparency(PdfDictionary ap, java.util.Set<PdfObject> checkedObjects)
-
checkObjectWithResourcesForTransparency
private void checkObjectWithResourcesForTransparency(PdfObject objectWithResources, java.util.Set<PdfObject> checkedObjects)
-
checkResourcesForTransparency
void checkResourcesForTransparency(PdfDictionary resources, java.util.Set<PdfObject> checkedObjects)
-
checkSingleResourceTypeForTransparency
private void checkSingleResourceTypeForTransparency(PdfDictionary singleResourceDict, java.util.Set<PdfObject> checkedObjects)
-
checkSeparationInsideDeviceN
private void checkSeparationInsideDeviceN(PdfArray separation, PdfObject deviceNColorSpace, PdfObject deviceNTintTransform)
-
checkSeparationCS
private void checkSeparationCS(PdfArray separation)
-
checkCatalogConfig
private void checkCatalogConfig(PdfDictionary config, java.util.HashSet<PdfObject> ocgs, java.util.HashSet<java.lang.String> names)
-
fillOrderRecursively
private void fillOrderRecursively(PdfArray orderArray, java.util.Set<PdfObject> order)
-
checkDefaultCS
private boolean checkDefaultCS(PdfObject pdfObject, PdfDictionary currentColorSpaces, java.lang.Boolean fill, PdfName defaultCsName, int numOfComponents)
-
checkType3FontGlyphs
private void checkType3FontGlyphs(PdfType3Font font, PdfStream contentStream)
-
-