Package com.itextpdf.pdfa.checker
Class PdfA4Checker
java.lang.Object
com.itextpdf.pdfa.checker.PdfAChecker
com.itextpdf.pdfa.checker.PdfA1Checker
com.itextpdf.pdfa.checker.PdfA2Checker
com.itextpdf.pdfa.checker.PdfA3Checker
com.itextpdf.pdfa.checker.PdfA4Checker
- All Implemented Interfaces:
IValidationChecker
PdfA4Checker defines the requirements of the PDF/A-4 standard and contains a
number of methods that override the implementations of its superclass
PdfA3Checker
.
The specification implemented by this class is ISO 19005-4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final org.slf4j.Logger
private static final String
Fields inherited from class com.itextpdf.pdfa.checker.PdfA3Checker
allowedAFRelationships
Fields inherited from class com.itextpdf.pdfa.checker.PdfA2Checker
allowedBlendModes, allowedFilters, allowedInlineImageFilters, forbiddenActions, forbiddenAnnotations, MAX_PAGE_SIZE, MIN_PAGE_SIZE, 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
ConstructorsConstructorDescriptionPdfA4Checker
(PdfAConformance aConformance) Creates a PdfA4Checker with the required conformance -
Method Summary
Modifier and TypeMethodDescriptionprotected 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.private void
checkAnnotationsForColorUsages
(PdfArray annotations, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) private void
checkAppearanceStreamForColorUsages
(PdfDictionary ap, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) protected void
checkBlendMode
(PdfName blendMode) Check if blendMode is compatible with pdf/a standard being used.void
checkCanvasStack
(char stackOperation) This method checks compliance with the graphics state architectural limitation, explained byPdfAChecker.maxGsStackDepth
.protected void
checkCatalog
(PdfCatalog catalog) Verify the conformity of the pdf catalog.protected void
Check the conformity of the AA dictionary on catalog level.protected void
checkCatalogValidEntries
(PdfDictionary catalogDict) Checks if entries in catalog dictionary are valid.void
checkColorSpace
(PdfColorSpace colorSpace, PdfObject pdfObject, PdfDictionary currentColorSpaces, boolean checkAlternate, 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
Check optional content configuration dictionary against AS key.private void
checkContentForColorUsages
(PdfObject pdfObject, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) 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.private void
protected void
checkFileSpec
(PdfDictionary fileSpec) Verify the conformity of the file specification dictionary.protected void
checkFormXObject
(PdfStream form, PdfStream contentStream) Verify the conformity of the Form XObject with appropriate specification.protected void
checkMetaData
(PdfDictionary catalog) Performs a number of checks on the metadata of the document.protected void
private void
checkObjectWithResourcesForColorUsages
(PdfObject objectWithResources, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) protected void
checkOutputIntents
(PdfDictionary catalog) Verify the conformity of the output intents array in the catalog dictionary.private void
checkPacketHeader
(byte[] meta) protected void
Check the conformity of the AA dictionary on catalog level.protected void
checkPageColorsUsages
(PdfDictionary pageDict, PdfDictionary pageResources) Verify the conformity of used color spaces on the page.private void
checkPageContentsForColorUsages
(PdfDictionary pageDict, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) protected void
checkPageObject
(PdfDictionary pageDict, PdfDictionary pageResources) Verify the conformity of the page dictionary.protected void
checkPageTransparency
(PdfDictionary pageDict, PdfDictionary pageResources) Verify the conformity of the page transparency.protected void
checkPdfNumber
(PdfNumber number) Verify the conformity of the PDF number.private void
checkResourcesForColorUsages
(PdfDictionary resources, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) void
checkSignatureType
(boolean isCAdES) This method checks compliance of the signature type.private void
checkSingleResourceTypeForColorUsages
(PdfDictionary singleResourceDict, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) protected void
checkTrailer
(PdfDictionary trailer) Verify the conformity of the trailer dictionary.private void
protected void
Check the conformity of the AA dictionary on widget level.Gets annotation types which are allowed not to have appearance stream.private static String
getColorspaceTypeIfIccBasedOrCalRgb
(PdfColorSpace colorspace) private static PdfColorSpace
Retrieve forbidden actions in conforming document.Gets forbidden annotation types.protected int
Retrieve maximum allowed length of the name object.protected int
Returns maximum allowed bytes length of the string in a PDF document.protected String
Retrieve transparency error message valid for the pdf/a standard being used.private static boolean
private boolean
isCMYKColorant
(PdfName colourant) private static void
isValidEncoding
(byte[] data) private static boolean
isValidXmpConformance
(String value) private static boolean
isValidXmpRevision
(String value) private static void
throwIfIdenticalProfiles
(PdfStream iccBasedProfile1, PdfStream iccBasedProfile2) Methods inherited from class com.itextpdf.pdfa.checker.PdfA2Checker
checkAnnotationsForTransparency, checkAppearanceStream, checkColor, checkContentsForTransparency, checkFontGlyphs, checkForm, checkFormXObject, checkImage, checkInlineImage, checkNonSymbolicTrueTypeFont, checkPageSize, checkPdfArray, checkPdfDictionary, checkPdfStream, checkResourcesForTransparency, checkSignature, checkTransparencyGroup, getAllowedNamedActions, getMaxRealValue
Methods inherited from class com.itextpdf.pdfa.checker.PdfA1Checker
checkAction, checkContentStream, checkCrypto, checkFont, checkLogicalStructure, checkPdfName, checkPdfString, checkRenderingIntent, checkSymbolicTrueTypeFont, checkText, checkXrefTable, getFormFields, getMaxIntegerValue, 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 Details
-
CALRGB_COLOR_SPACE
- See Also:
-
forbiddenAnnotations4
-
forbiddenAnnotations4E
-
forbiddenAnnotations4F
-
apLessAnnotations
-
allowedBlendModes4
-
TRANSPARENCY_ERROR_MESSAGE
- See Also:
-
LOGGER
private static final org.slf4j.Logger LOGGER -
forbiddenActionsE
-
allowedEntriesInAAWhenNonWidget
-
iccBasedCmykObjects
-
-
Constructor Details
-
PdfA4Checker
Creates a PdfA4Checker with the required conformance- Parameters:
aConformance
- the required conformance
-
-
Method Details
-
checkColorSpace
public void checkColorSpace(PdfColorSpace colorSpace, PdfObject pdfObject, PdfDictionary currentColorSpaces, boolean checkAlternate, 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 classPdfA2Checker
- 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
-
checkPageColorsUsages
Verify the conformity of used color spaces on the page.- Overrides:
checkPageColorsUsages
in classPdfA2Checker
- Parameters:
pageDict
- thePdfDictionary
contains contents for colors to be checkedpageResources
- thePdfDictionary
contains resources for colors to be checked
-
checkTrailer
Verify the conformity of the trailer dictionary.- Overrides:
checkTrailer
in classPdfA1Checker
- Parameters:
trailer
- thePdfDictionary
of trailer to check
-
checkCatalog
Verify the conformity of the pdf catalog.- Overrides:
checkCatalog
in classPdfA1Checker
- Parameters:
catalog
- thePdfCatalog
of trailer to check
-
checkPageObject
Verify the conformity of the page dictionary.- Overrides:
checkPageObject
in classPdfA2Checker
- Parameters:
pageDict
- thePdfDictionary
to checkpageResources
- the page's resources dictionary
-
checkCatalogValidEntries
Checks if entries in catalog dictionary are valid.- Overrides:
checkCatalogValidEntries
in classPdfA2Checker
- Parameters:
catalogDict
- the catalogPdfDictionary
to be checked
-
checkFileSpec
Verify the conformity of the file specification dictionary.- Overrides:
checkFileSpec
in classPdfA3Checker
- Parameters:
fileSpec
- thePdfDictionary
containing file specification to be checked
-
checkPageTransparency
Verify the conformity of the page transparency.- Overrides:
checkPageTransparency
in classPdfA2Checker
- Parameters:
pageDict
- thePdfDictionary
contains contents for transparency to be checkedpageResources
- thePdfDictionary
contains resources for transparency to be checked
-
checkCatalogAAConformance
Check the conformity of the AA dictionary on catalog level.- Overrides:
checkCatalogAAConformance
in classPdfA2Checker
- Parameters:
dict
- the catalog dictionary
-
checkPageAAConformance
Check the conformity of the AA dictionary on catalog level.- Overrides:
checkPageAAConformance
in classPdfA2Checker
- Parameters:
dict
- the catalog dictionary
-
checkPdfNumber
Verify the conformity of the PDF number.- Overrides:
checkPdfNumber
in classPdfA1Checker
- Parameters:
number
- thePdfNumber
to check
-
checkCanvasStack
public void checkCanvasStack(char stackOperation) This method checks compliance with the graphics state architectural limitation, explained byPdfAChecker.maxGsStackDepth
.- Overrides:
checkCanvasStack
in classPdfA1Checker
- Parameters:
stackOperation
- the operation to check the graphics state counter for
-
checkSignatureType
public void checkSignatureType(boolean isCAdES) This method checks compliance of the signature type.- Overrides:
checkSignatureType
in classPdfA1Checker
- Parameters:
isCAdES
-true
if CAdES signature type is used,false
otherwise
-
getMaxStringLength
protected int getMaxStringLength()Returns maximum allowed bytes length of the string in a PDF document.- Overrides:
getMaxStringLength
in classPdfA2Checker
- Returns:
- maximum string length
-
checkNumberOfDeviceNComponents
- Overrides:
checkNumberOfDeviceNComponents
in classPdfA2Checker
-
checkExtGState
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 classPdfA2Checker
- Parameters:
extGState
- the graphics state to be checkedcontentStream
- current content stream
-
checkFormXObject
Verify the conformity of the Form XObject with appropriate specification. Throws PdfAConformanceException if any discrepancy was found- Overrides:
checkFormXObject
in classPdfA2Checker
- Parameters:
form
- thePdfStream
to be checkedcontentStream
- thePdfStream
current content stream
-
checkAnnotation
Verify the conformity of the annotation dictionary.- Overrides:
checkAnnotation
in classPdfA2Checker
- Parameters:
annotDic
- the annotationPdfDictionary
to be checked
-
getForbiddenAnnotations
Gets forbidden annotation types.- Overrides:
getForbiddenAnnotations
in classPdfA2Checker
- Returns:
- a set of forbidden annotation types
-
getAppearanceLessAnnotations
Gets annotation types which are allowed not to have appearance stream.- Overrides:
getAppearanceLessAnnotations
in classPdfA2Checker
- Returns:
- set of annotation names.
-
checkWidgetAAConformance
Check the conformity of the AA dictionary on widget level.- Parameters:
dict
- the widget dictionary
-
checkMetaData
Description copied from class:PdfAChecker
Performs a number of checks on the metadata of the document.- Overrides:
checkMetaData
in classPdfA1Checker
- Parameters:
catalog
- the catalogPdfDictionary
to check
-
checkOutputIntents
Verify the conformity of the output intents array in the catalog dictionary.- Overrides:
checkOutputIntents
in classPdfA2Checker
- Parameters:
catalog
- thePdfDictionary
of a catalog or page to check
-
checkAnnotationAgainstActions
Checked annotation against actions, exception will be thrown if eitherA
orAA
actions aren't allowed for specific type of annotation.- Overrides:
checkAnnotationAgainstActions
in classPdfA2Checker
- Parameters:
annotDic
- an annotation PDF dictionary
-
hasAAIllegalEntries
-
getForbiddenActions
Retrieve forbidden actions in conforming document.- Overrides:
getForbiddenActions
in classPdfA2Checker
- Returns:
- set of
PdfName
with forbidden actions
-
checkContentConfigurationDictAgainstAsKey
Check optional content configuration dictionary against AS key.- Overrides:
checkContentConfigurationDictAgainstAsKey
in classPdfA2Checker
- Parameters:
config
- a content configuration dictionary
-
getTransparencyErrorMessage
Retrieve transparency error message valid for the pdf/a standard being used.- Overrides:
getTransparencyErrorMessage
in classPdfA2Checker
- Returns:
- error message.
-
checkBlendMode
Check if blendMode is compatible with pdf/a standard being used.- Overrides:
checkBlendMode
in classPdfA2Checker
- Parameters:
blendMode
- blend mode name to check.
-
getMaxNameLength
protected int getMaxNameLength()Retrieve maximum allowed length of the name object.- Overrides:
getMaxNameLength
in classPdfA1Checker
- Returns:
- maximum allowed length of the name
-
isValidEncoding
private static void isValidEncoding(byte[] data) -
isValidXmpConformance
-
isValidXmpRevision
-
checkPacketHeader
private void checkPacketHeader(byte[] meta) -
checkFileProvenanceSpec
-
checkVersionIdentification
-
isCMYKColorant
-
checkPageContentsForColorUsages
private void checkPageContentsForColorUsages(PdfDictionary pageDict, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) -
checkAnnotationsForColorUsages
private void checkAnnotationsForColorUsages(PdfArray annotations, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) -
checkAppearanceStreamForColorUsages
private void checkAppearanceStreamForColorUsages(PdfDictionary ap, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) -
checkObjectWithResourcesForColorUsages
private void checkObjectWithResourcesForColorUsages(PdfObject objectWithResources, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) -
checkResourcesForColorUsages
private void checkResourcesForColorUsages(PdfDictionary resources, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) -
checkSingleResourceTypeForColorUsages
private void checkSingleResourceTypeForColorUsages(PdfDictionary singleResourceDict, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) -
checkContentForColorUsages
private void checkContentForColorUsages(PdfObject pdfObject, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS) -
throwIfIdenticalProfiles
-
getColorspaceTypeIfIccBasedOrCalRgb
-
getDeviceIndependentTransparencyBlendingCSIfRbgOrCmykBased
private static PdfColorSpace getDeviceIndependentTransparencyBlendingCSIfRbgOrCmykBased(PdfDictionary pageDict)
-