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
public class PdfA4Checker extends PdfA3Checker
PdfA4Checker defines the requirements of the PDF/A-4 standard and contains a number of methods that override the implementations of its superclassPdfA3Checker.The specification implemented by this class is ISO 19005-4
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Set<PdfName>allowedBlendModes4private static java.util.Set<PdfName>allowedEntriesInAAWhenNonWidgetprivate static java.util.Set<PdfName>apLessAnnotationsprivate static java.lang.StringCALRGB_COLOR_SPACEprivate static java.util.Set<PdfName>forbiddenActionsEprivate static java.util.Set<PdfName>forbiddenAnnotations4private static java.util.Set<PdfName>forbiddenAnnotations4Eprivate static java.util.Set<PdfName>forbiddenAnnotations4Fprivate java.util.Map<PdfObject,java.util.List<PdfStream>>iccBasedCmykObjectsprivate static org.slf4j.LoggerLOGGERprivate static java.lang.StringTRANSPARENCY_ERROR_MESSAGE-
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, EXCEPTION_SUPPLIER, 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 PdfA4Checker(PdfAConformance aConformance)Creates a PdfA4Checker with the required conformance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckAnnotation(PdfDictionary annotDic)Verify the conformity of the annotation dictionary.protected voidcheckAnnotationAgainstActions(PdfDictionary annotDic)Checked annotation against actions, exception will be thrown if eitherAorAAactions aren't allowed for specific type of annotation.private voidcheckAnnotationsForColorUsages(PdfArray annotations, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS)private voidcheckAppearanceStreamForColorUsages(PdfDictionary ap, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS)protected voidcheckBlendMode(PdfName blendMode)Check if blendMode is compatible with pdf/a standard being used.voidcheckCanvasStack(char stackOperation)This method checks compliance with the graphics state architectural limitation, explained byPdfAChecker.maxGsStackDepth.protected voidcheckCatalog(PdfCatalog catalog)Verify the conformity of the pdf catalog.protected voidcheckCatalogAAConformance(PdfDictionary dict)Check the conformity of the AA dictionary on catalog level.protected voidcheckCatalogValidEntries(PdfDictionary catalogDict)Checks if entries in catalog dictionary are valid.voidcheckColorSpace(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 voidcheckContentConfigurationDictAgainstAsKey(PdfDictionary config)Check optional content configuration dictionary against AS key.private voidcheckContentForColorUsages(PdfObject pdfObject, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS)voidcheckExtGState(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 voidcheckFileProvenanceSpec(XMPMeta meta)protected voidcheckFileSpec(PdfDictionary fileSpec)Verify the conformity of the file specification dictionary.protected voidcheckFormXObject(PdfStream form, PdfStream contentStream)Verify the conformity of the Form XObject with appropriate specification.protected voidcheckMetaData(PdfDictionary catalog)Performs a number of checks on the metadata of the document.protected voidcheckNumberOfDeviceNComponents(PdfSpecialCs.DeviceN deviceN)Checks the number of components in DeviceN color space.private voidcheckObjectWithResourcesForColorUsages(PdfObject objectWithResources, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS)protected voidcheckOutputIntents(PdfDictionary catalog)Verify the conformity of the output intents array in the catalog dictionary.private voidcheckPacketHeader(byte[] meta)protected voidcheckPageAAConformance(PdfDictionary dict)Check the conformity of the AA dictionary on catalog level.protected voidcheckPageColorsUsages(PdfDictionary pageDict, PdfDictionary pageResources)Verify the conformity of used color spaces on the page.private voidcheckPageContentsForColorUsages(PdfDictionary pageDict, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS)protected voidcheckPageObject(PdfDictionary pageDict, PdfDictionary pageResources)Verify the conformity of the page dictionary.protected voidcheckPageTransparency(PdfDictionary pageDict, PdfDictionary pageResources)Verify the conformity of the page transparency.protected voidcheckPdfNumber(PdfNumber number)Verify the conformity of the PDF number.private voidcheckResourcesForColorUsages(PdfDictionary resources, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS)voidcheckSignatureType(boolean isCAdES)This method checks compliance of the signature type.private voidcheckSingleResourceTypeForColorUsages(PdfDictionary singleResourceDict, PdfStream pageIntentProfile, PdfColorSpace pageTransparencyBlendingCS)protected voidcheckTrailer(PdfDictionary trailer)Verify the conformity of the trailer dictionary.protected voidcheckWidgetAAConformance(PdfDictionary dict)Check the conformity of the AA dictionary on widget level.protected java.util.Set<PdfName>getAppearanceLessAnnotations()Gets annotation types which are allowed not to have appearance stream.private static java.lang.StringgetColorspaceTypeIfIccBasedOrCalRgb(PdfColorSpace colorspace)private static PdfColorSpacegetDeviceIndependentTransparencyBlendingCSIfRbgOrCmykBased(PdfDictionary pageDict)protected java.util.Set<PdfName>getForbiddenActions()Retrieve forbidden actions in conforming document.protected java.util.Set<PdfName>getForbiddenAnnotations()Gets forbidden annotation types.protected intgetMaxNameLength()Retrieve maximum allowed length of the name object.protected intgetMaxStringLength()Returns maximum allowed bytes length of the string in a PDF document.protected java.lang.StringgetTransparencyErrorMessage()Retrieve transparency error message valid for the pdf/a standard being used.private static booleanhasAAIllegalEntries(PdfDictionary aa)private booleanisCMYKColorant(PdfName colourant)private static voidisValidEncoding(byte[] data)private static booleanisValidXmpConformance(java.lang.String value)A PDF/A-4e conforming file shall specify the value ofpdfa:conformanceas E.private static voidthrowIfIdenticalProfiles(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 Detail
-
CALRGB_COLOR_SPACE
private static final java.lang.String CALRGB_COLOR_SPACE
- See Also:
- Constant Field Values
-
forbiddenAnnotations4
private static final java.util.Set<PdfName> forbiddenAnnotations4
-
forbiddenAnnotations4E
private static final java.util.Set<PdfName> forbiddenAnnotations4E
-
forbiddenAnnotations4F
private static final java.util.Set<PdfName> forbiddenAnnotations4F
-
apLessAnnotations
private static final java.util.Set<PdfName> apLessAnnotations
-
allowedBlendModes4
private static final java.util.Set<PdfName> allowedBlendModes4
-
TRANSPARENCY_ERROR_MESSAGE
private static final java.lang.String TRANSPARENCY_ERROR_MESSAGE
- See Also:
- Constant Field Values
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
forbiddenActionsE
private static final java.util.Set<PdfName> forbiddenActionsE
-
allowedEntriesInAAWhenNonWidget
private static final java.util.Set<PdfName> allowedEntriesInAAWhenNonWidget
-
-
Constructor Detail
-
PdfA4Checker
public PdfA4Checker(PdfAConformance aConformance)
Creates a PdfA4Checker with the required conformance- Parameters:
aConformance- the required conformance
-
-
Method Detail
-
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:
checkColorSpacein classPdfA2Checker- Parameters:
colorSpace- the color space to checkpdfObject- the pdf object to check color space incurrentColorSpaces- aPdfDictionarycontaining 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
protected void checkPageColorsUsages(PdfDictionary pageDict, PdfDictionary pageResources)
Verify the conformity of used color spaces on the page.- Overrides:
checkPageColorsUsagesin classPdfA2Checker- Parameters:
pageDict- thePdfDictionarycontains contents for colors to be checkedpageResources- thePdfDictionarycontains resources for colors to be checked
-
checkTrailer
protected void checkTrailer(PdfDictionary trailer)
Verify the conformity of the trailer dictionary.- Overrides:
checkTrailerin classPdfA1Checker- Parameters:
trailer- thePdfDictionaryof trailer to check
-
checkCatalog
protected void checkCatalog(PdfCatalog catalog)
Verify the conformity of the pdf catalog.- Overrides:
checkCatalogin classPdfA1Checker- Parameters:
catalog- thePdfCatalogof trailer to check
-
checkPageObject
protected void checkPageObject(PdfDictionary pageDict, PdfDictionary pageResources)
Verify the conformity of the page dictionary.- Overrides:
checkPageObjectin classPdfA2Checker- Parameters:
pageDict- thePdfDictionaryto checkpageResources- the page's resources dictionary
-
checkCatalogValidEntries
protected void checkCatalogValidEntries(PdfDictionary catalogDict)
Checks if entries in catalog dictionary are valid.- Overrides:
checkCatalogValidEntriesin classPdfA2Checker- Parameters:
catalogDict- the catalogPdfDictionaryto be checked
-
checkFileSpec
protected void checkFileSpec(PdfDictionary fileSpec)
Verify the conformity of the file specification dictionary.- Overrides:
checkFileSpecin classPdfA3Checker- Parameters:
fileSpec- thePdfDictionarycontaining file specification to be checked
-
checkPageTransparency
protected void checkPageTransparency(PdfDictionary pageDict, PdfDictionary pageResources)
Verify the conformity of the page transparency.- Overrides:
checkPageTransparencyin classPdfA2Checker- Parameters:
pageDict- thePdfDictionarycontains contents for transparency to be checkedpageResources- thePdfDictionarycontains resources for transparency to be checked
-
checkCatalogAAConformance
protected void checkCatalogAAConformance(PdfDictionary dict)
Check the conformity of the AA dictionary on catalog level.- Overrides:
checkCatalogAAConformancein classPdfA2Checker- Parameters:
dict- the catalog dictionary
-
checkPageAAConformance
protected void checkPageAAConformance(PdfDictionary dict)
Check the conformity of the AA dictionary on catalog level.- Overrides:
checkPageAAConformancein classPdfA2Checker- Parameters:
dict- the catalog dictionary
-
checkPdfNumber
protected void checkPdfNumber(PdfNumber number)
Verify the conformity of the PDF number.- Overrides:
checkPdfNumberin classPdfA1Checker- Parameters:
number- thePdfNumberto check
-
checkCanvasStack
public void checkCanvasStack(char stackOperation)
This method checks compliance with the graphics state architectural limitation, explained byPdfAChecker.maxGsStackDepth.- Overrides:
checkCanvasStackin 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:
checkSignatureTypein classPdfA1Checker- Parameters:
isCAdES-trueif CAdES signature type is used,falseotherwise
-
getMaxStringLength
protected int getMaxStringLength()
Returns maximum allowed bytes length of the string in a PDF document.- Overrides:
getMaxStringLengthin classPdfA2Checker- Returns:
- maximum string length
-
checkNumberOfDeviceNComponents
protected void checkNumberOfDeviceNComponents(PdfSpecialCs.DeviceN deviceN)
Checks the number of components in DeviceN color space.- Overrides:
checkNumberOfDeviceNComponentsin classPdfA2Checker- Parameters:
deviceN- the color space to check
-
checkExtGState
public void checkExtGState(CanvasGraphicsState extGState, PdfStream contentStream)
Description copied from class:PdfACheckerPerforms 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:
checkExtGStatein classPdfA2Checker- Parameters:
extGState- the graphics state to be checkedcontentStream- current content stream
-
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- Overrides:
checkFormXObjectin classPdfA2Checker- Parameters:
form- thePdfStreamto be checkedcontentStream- thePdfStreamcurrent content stream
-
checkAnnotation
protected void checkAnnotation(PdfDictionary annotDic)
Verify the conformity of the annotation dictionary.- Overrides:
checkAnnotationin classPdfA2Checker- Parameters:
annotDic- the annotationPdfDictionaryto be checked
-
getForbiddenAnnotations
protected java.util.Set<PdfName> getForbiddenAnnotations()
Gets forbidden annotation types.- Overrides:
getForbiddenAnnotationsin classPdfA2Checker- Returns:
- a set of forbidden annotation types
-
getAppearanceLessAnnotations
protected java.util.Set<PdfName> getAppearanceLessAnnotations()
Gets annotation types which are allowed not to have appearance stream.- Overrides:
getAppearanceLessAnnotationsin classPdfA2Checker- Returns:
- set of annotation names.
-
checkWidgetAAConformance
protected void checkWidgetAAConformance(PdfDictionary dict)
Check the conformity of the AA dictionary on widget level.- Parameters:
dict- the widget dictionary
-
checkMetaData
protected void checkMetaData(PdfDictionary catalog)
Description copied from class:PdfACheckerPerforms a number of checks on the metadata of the document.- Overrides:
checkMetaDatain classPdfA1Checker- Parameters:
catalog- the catalogPdfDictionaryto check
-
checkOutputIntents
protected void checkOutputIntents(PdfDictionary catalog)
Verify the conformity of the output intents array in the catalog dictionary.- Overrides:
checkOutputIntentsin classPdfA2Checker- Parameters:
catalog- thePdfDictionaryof a catalog or page to check
-
checkAnnotationAgainstActions
protected void checkAnnotationAgainstActions(PdfDictionary annotDic)
Checked annotation against actions, exception will be thrown if eitherAorAAactions aren't allowed for specific type of annotation.- Overrides:
checkAnnotationAgainstActionsin classPdfA2Checker- Parameters:
annotDic- an annotation PDF dictionary
-
hasAAIllegalEntries
private static boolean hasAAIllegalEntries(PdfDictionary aa)
-
getForbiddenActions
protected java.util.Set<PdfName> getForbiddenActions()
Retrieve forbidden actions in conforming document.- Overrides:
getForbiddenActionsin classPdfA2Checker- Returns:
- set of
PdfNamewith forbidden actions
-
checkContentConfigurationDictAgainstAsKey
protected void checkContentConfigurationDictAgainstAsKey(PdfDictionary config)
Check optional content configuration dictionary against AS key.- Overrides:
checkContentConfigurationDictAgainstAsKeyin classPdfA2Checker- Parameters:
config- a content configuration dictionary
-
getTransparencyErrorMessage
protected java.lang.String getTransparencyErrorMessage()
Retrieve transparency error message valid for the pdf/a standard being used.- Overrides:
getTransparencyErrorMessagein classPdfA2Checker- Returns:
- error message.
-
checkBlendMode
protected void checkBlendMode(PdfName blendMode)
Check if blendMode is compatible with pdf/a standard being used.- Overrides:
checkBlendModein classPdfA2Checker- Parameters:
blendMode- blend mode name to check.
-
getMaxNameLength
protected int getMaxNameLength()
Retrieve maximum allowed length of the name object.- Overrides:
getMaxNameLengthin classPdfA1Checker- Returns:
- maximum allowed length of the name
-
isValidEncoding
private static void isValidEncoding(byte[] data)
-
isValidXmpConformance
private static boolean isValidXmpConformance(java.lang.String value)
A PDF/A-4e conforming file shall specify the value ofpdfa:conformanceas E. A PDF/A-4f conforming file shall specify the value ofpdfa:conformanceas F. A file that does not conform to either PDF/A-4e or PDF/A-4f shall not provide anypdfa:conformance.- Parameters:
value-pdfa:conformancevalue to check- Returns:
trueifpdfa:conformancevalue is valid,falseotherwise
-
checkPacketHeader
private void checkPacketHeader(byte[] meta)
-
checkFileProvenanceSpec
private void checkFileProvenanceSpec(XMPMeta meta)
-
isCMYKColorant
private boolean isCMYKColorant(PdfName colourant)
-
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
private static void throwIfIdenticalProfiles(PdfStream iccBasedProfile1, PdfStream iccBasedProfile2)
-
getColorspaceTypeIfIccBasedOrCalRgb
private static java.lang.String getColorspaceTypeIfIccBasedOrCalRgb(PdfColorSpace colorspace)
-
getDeviceIndependentTransparencyBlendingCSIfRbgOrCmykBased
private static PdfColorSpace getDeviceIndependentTransparencyBlendingCSIfRbgOrCmykBased(PdfDictionary pageDict)
-
-