Package com.itextpdf.pdfa.checker
Class PdfA1Checker
- java.lang.Object
-
- com.itextpdf.pdfa.checker.PdfAChecker
-
- com.itextpdf.pdfa.checker.PdfA1Checker
-
- All Implemented Interfaces:
IValidationChecker
- Direct Known Subclasses:
PdfA2Checker
public class PdfA1Checker extends PdfAChecker
PdfA1Checker defines the requirements of the PDF/A-1 standard and contains method implementations from the abstractPdfACheckerclass.The specification implemented by this class is ISO 19005-1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPdfA1Checker.ACharacterChecker
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Set<PdfName>allowedNamedActionsprotected static java.util.Set<PdfName>allowedRenderingIntentsprotected static java.util.Set<PdfName>contentAnnotationsprotected static java.util.Set<PdfName>forbiddenActionsprotected static java.util.Set<PdfName>forbiddenAnnotationsprivate static org.slf4j.Loggerloggerprivate static intMAX_NUMBER_OF_DEVICEN_COLOR_COMPONENTS-
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 PdfA1Checker(PdfAConformance aConformance)Creates a PdfA1Checker with the required conformance
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcheckAction(PdfDictionary action)Checks if the action is allowed.protected voidcheckAnnotation(PdfDictionary annotDic)Verify the conformity of the annotation dictionary.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 voidcheckCatalogValidEntries(PdfDictionary catalogDict)Checks if entries in catalog dictionary are valid.voidcheckColor(CanvasGraphicsState graphicsState, Color color, PdfDictionary currentColorSpaces, java.lang.Boolean fill, PdfStream stream)This method checks compliance with the color restrictions imposed by the available color spaces in the document.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 voidcheckContentStream(PdfStream contentStream)Attest content stream conformance with appropriate specification.voidcheckCrypto(PdfObject crypto)Verify the conformity of encryption usage.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.protected voidcheckFileSpec(PdfDictionary fileSpec)Verify the conformity of the file specification dictionary.voidcheckFont(PdfFont pdfFont)Performs a number of checks on the font.voidcheckFontGlyphs(PdfFont font, PdfStream contentStream)Performs a check of the each font glyph as a Form XObject.protected voidcheckForm(PdfDictionary form)Verify the conformity of the form dictionary.protected voidcheckFormXObject(PdfStream form)Verify the conformity of the form XObject dictionary.protected voidcheckImage(PdfStream image, PdfDictionary currentColorSpaces)Verify the conformity of the given image.voidcheckInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces)This method checks compliance with the inline image restrictions in the PDF/A specs, specifically filter parameters.protected voidcheckLogicalStructure(PdfDictionary catalog)Performs a number of checks on the logical structure of the document.protected voidcheckMetaData(PdfDictionary catalog)Performs a number of checks on the metadata of the document.protected voidcheckNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)Verify the conformity of the non-symbolic TrueType font.protected voidcheckOutputIntents(PdfDictionary catalog)Verify the conformity of the output intents array in the catalog dictionary.protected voidcheckPageColorsUsages(PdfDictionary pageDict, PdfDictionary pageResources)Verify the conformity of used color spaces on the page.protected voidcheckPageObject(PdfDictionary pageDict, PdfDictionary pageResources)Verify the conformity of the page dictionary.protected voidcheckPageSize(PdfDictionary page)Checks the allowable size of the page.protected voidcheckPageTransparency(PdfDictionary pageDict, PdfDictionary pageResources)Verify the conformity of the page transparency.protected voidcheckPdfArray(PdfArray array)Verify the conformity of the PDF array.protected voidcheckPdfDictionary(PdfDictionary dictionary)Verify the conformity of the PDF dictionary.protected voidcheckPdfName(PdfName name)Verify the conformity of the PDF name.protected voidcheckPdfNumber(PdfNumber number)Verify the conformity of the PDF number.protected voidcheckPdfStream(PdfStream stream)Verify the conformity of the PDF stream.protected voidcheckPdfString(PdfString string)Verify the conformity of the PDF string.voidcheckRenderingIntent(PdfName intent)Checks whether the rendering intent of the document is within the allowed range of intents.voidcheckSignatureType(boolean isCAdES)This method checks compliance of the signature type.protected voidcheckSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)Verify the conformity of the symbolic TrueType font.voidcheckText(java.lang.String text, PdfFont font)Verify the conformity of the text written by the specified font.protected voidcheckTrailer(PdfDictionary trailer)Verify the conformity of the trailer dictionary.voidcheckXrefTable(PdfXrefTable xrefTable)Verify the conformity of the cross-reference table.protected java.util.Set<PdfName>getAllowedNamedActions()Retrieve allowed actions in conforming document.protected java.util.Set<PdfName>getForbiddenActions()Retrieve forbidden actions in conforming document.protected java.util.Set<PdfName>getForbiddenAnnotations()Gets forbidden annotation types.protected PdfArraygetFormFields(PdfArray array)Deprecated.in favour ofPdfCheckersUtil.getFormFields(PdfArray)private intgetMaxArrayCapacity()private intgetMaxDictionaryCapacity()protected longgetMaxIntegerValue()Retrieve maximal allowed integer value.protected intgetMaxNameLength()Retrieve maximum allowed length of the name object.protected longgetMaxNumberOfIndirectObjects()Retrieve maximum allowed number of indirect objects in conforming document.protected doublegetMaxRealValue()Retrieve maximum allowed real value.protected intgetMaxStringLength()Returns maximum allowed bytes length of the string in a PDF document.protected longgetMinIntegerValue()Retrieve minimal allowed integer value.private static booleanisAnnotationInvisible(int flags)-
Methods inherited from class com.itextpdf.pdfa.checker.PdfAChecker
checkAppearanceStream, checkContentStreamObject, checkDocument, checkFlag, checkPdfObject, checkResources, checkResourcesOfAppearanceStreams, checkSignature, checkSinglePage, checkStructure, checkTagStructureElement, getAConformance, getPdfAOutputIntent, isAlreadyChecked, isContainsTransparencyGroup, isFullCheckMode, isPdfObjectReadyToFlush, setFullCheckMode, setPdfAOutputIntentColorSpace, validate
-
-
-
-
Field Detail
-
forbiddenAnnotations
protected static final java.util.Set<PdfName> forbiddenAnnotations
-
contentAnnotations
protected static final java.util.Set<PdfName> contentAnnotations
-
forbiddenActions
protected static final java.util.Set<PdfName> forbiddenActions
-
allowedNamedActions
protected static final java.util.Set<PdfName> allowedNamedActions
-
allowedRenderingIntents
protected static final java.util.Set<PdfName> allowedRenderingIntents
-
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
-
-
Constructor Detail
-
PdfA1Checker
public PdfA1Checker(PdfAConformance aConformance)
Creates a PdfA1Checker with the required conformance- Parameters:
aConformance- the required conformance,aorb
-
-
Method Detail
-
checkCanvasStack
public void checkCanvasStack(char stackOperation)
Description copied from class:PdfACheckerThis method checks compliance with the graphics state architectural limitation, explained byPdfAChecker.maxGsStackDepth.- Specified by:
checkCanvasStackin classPdfAChecker- Parameters:
stackOperation- the operation to check the graphics state counter for
-
checkInlineImage
public void checkInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces)
Description copied from class:PdfACheckerThis method checks compliance with the inline image restrictions in the PDF/A specs, specifically filter parameters.- Specified by:
checkInlineImagein classPdfAChecker- Parameters:
inlineImage- aPdfStreamcontaining the inline imagecurrentColorSpaces- aPdfDictionarycontaining the color spaces used in the document
-
checkColor
public void checkColor(CanvasGraphicsState graphicsState, Color color, PdfDictionary currentColorSpaces, java.lang.Boolean fill, PdfStream stream)
This method checks compliance with the color restrictions imposed by the available color spaces in the document.- Specified by:
checkColorin classPdfAChecker- Parameters:
graphicsState- canvas graphics statecolor- the color to checkcurrentColorSpaces- aPdfDictionarycontaining the color spaces used in the documentfill- whether the color is used for fill or stroke operationsstream- 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.- Specified by:
checkColorSpacein classPdfAChecker- 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
-
checkXrefTable
public void checkXrefTable(PdfXrefTable xrefTable)
Description copied from class:PdfACheckerVerify the conformity of the cross-reference table.- Specified by:
checkXrefTablein classPdfAChecker- Parameters:
xrefTable- is the Xref table
-
getForbiddenActions
protected java.util.Set<PdfName> getForbiddenActions()
Description copied from class:PdfACheckerRetrieve forbidden actions in conforming document.- Specified by:
getForbiddenActionsin classPdfAChecker- Returns:
- set of
PdfNamewith forbidden actions
-
getAllowedNamedActions
protected java.util.Set<PdfName> getAllowedNamedActions()
Description copied from class:PdfACheckerRetrieve allowed actions in conforming document.- Specified by:
getAllowedNamedActionsin classPdfAChecker- Returns:
- set of
PdfNamewith allowed named actions
-
getMaxNumberOfIndirectObjects
protected long getMaxNumberOfIndirectObjects()
Description copied from class:PdfACheckerRetrieve maximum allowed number of indirect objects in conforming document.- Specified by:
getMaxNumberOfIndirectObjectsin classPdfAChecker- Returns:
- maximum allowed number of indirect objects
-
checkPageColorsUsages
protected void checkPageColorsUsages(PdfDictionary pageDict, PdfDictionary pageResources)
Verify the conformity of used color spaces on the page.- Specified by:
checkPageColorsUsagesin classPdfAChecker- Parameters:
pageDict- thePdfDictionarycontains contents for colors to be checkedpageResources- thePdfDictionarycontains resources for colors to be checked
-
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- Specified by:
checkExtGStatein classPdfAChecker- Parameters:
extGState- the graphics state to be checkedcontentStream- current content stream
-
checkFontGlyphs
public void checkFontGlyphs(PdfFont font, PdfStream contentStream)
Description copied from class:PdfACheckerPerforms 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- Specified by:
checkFontGlyphsin classPdfAChecker- Parameters:
font-PdfFontto be checkedcontentStream- stream containing checked font
-
checkRenderingIntent
public void checkRenderingIntent(PdfName intent)
Description copied from class:PdfACheckerChecks whether the rendering intent of the document is within the allowed range of intents. This is defined in ISO 19005-1 section 6.2.9, and unchanged in newer generations of the PDF/A specification.- Specified by:
checkRenderingIntentin classPdfAChecker- Parameters:
intent- the intent to be analyzed
-
checkFont
public void checkFont(PdfFont pdfFont)
Description copied from class:PdfACheckerPerforms a number of checks on the font. See ISO 19005-1 section 6.3, ISO 19005-2 and ISO 19005-3 section 6.2.11. Be aware that not all constraints defined in the ISO are checked in this method, for most of them we consider that iText always creates valid fonts.- Specified by:
checkFontin classPdfAChecker- Parameters:
pdfFont- font to be checked
-
checkCrypto
public void checkCrypto(PdfObject crypto)
Verify the conformity of encryption usage.- Specified by:
checkCryptoin classPdfAChecker- Parameters:
crypto- encryption object to verify
-
checkSignatureType
public void checkSignatureType(boolean isCAdES)
This method checks compliance of the signature type.- Specified by:
checkSignatureTypein classPdfAChecker- Parameters:
isCAdES-trueif CAdES signature type is used,falseotherwise
-
checkText
public void checkText(java.lang.String text, PdfFont font)Verify the conformity of the text written by the specified font.- Specified by:
checkTextin classPdfAChecker- Parameters:
text- text to verifyfont- font to verify the text against
-
checkPageTransparency
protected void checkPageTransparency(PdfDictionary pageDict, PdfDictionary pageResources)
Description copied from class:PdfACheckerVerify the conformity of the page transparency.- Specified by:
checkPageTransparencyin classPdfAChecker- Parameters:
pageDict- thePdfDictionarycontains contents for transparency to be checkedpageResources- thePdfDictionarycontains resources for transparency to be checked
-
checkContentStream
protected void checkContentStream(PdfStream contentStream)
Description copied from class:PdfACheckerAttest content stream conformance with appropriate specification. Throws PdfAConformanceException if any discrepancy was found- Specified by:
checkContentStreamin classPdfAChecker- Parameters:
contentStream- is a content stream to validate
-
checkNonSymbolicTrueTypeFont
protected void checkNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
Description copied from class:PdfACheckerVerify the conformity of the non-symbolic TrueType font.- Specified by:
checkNonSymbolicTrueTypeFontin classPdfAChecker- Parameters:
trueTypeFont- thePdfTrueTypeFontto check
-
checkSymbolicTrueTypeFont
protected void checkSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
Description copied from class:PdfACheckerVerify the conformity of the symbolic TrueType font.- Specified by:
checkSymbolicTrueTypeFontin classPdfAChecker- Parameters:
trueTypeFont- thePdfTrueTypeFontto check
-
checkImage
protected void checkImage(PdfStream image, PdfDictionary currentColorSpaces)
Description copied from class:PdfACheckerVerify the conformity of the given image.- Specified by:
checkImagein classPdfAChecker- Parameters:
image- the image to checkcurrentColorSpaces- thePdfDictionarycontaining the color spaces used in the document
-
checkFormXObject
protected void checkFormXObject(PdfStream form)
Description copied from class:PdfACheckerVerify the conformity of the form XObject dictionary.- Specified by:
checkFormXObjectin classPdfAChecker- Parameters:
form- thePdfStreamto check
-
checkLogicalStructure
protected void checkLogicalStructure(PdfDictionary catalog)
Description copied from class:PdfACheckerPerforms a number of checks on the logical structure of the document.- Specified by:
checkLogicalStructurein classPdfAChecker- Parameters:
catalog- the catalogPdfDictionaryto check
-
checkMetaData
protected void checkMetaData(PdfDictionary catalog)
Description copied from class:PdfACheckerPerforms a number of checks on the metadata of the document.- Specified by:
checkMetaDatain classPdfAChecker- Parameters:
catalog- the catalogPdfDictionaryto check
-
checkOutputIntents
protected void checkOutputIntents(PdfDictionary catalog)
Description copied from class:PdfACheckerVerify the conformity of the output intents array in the catalog dictionary.- Specified by:
checkOutputIntentsin classPdfAChecker- Parameters:
catalog- thePdfDictionaryof a catalog or page to check
-
checkPdfNumber
protected void checkPdfNumber(PdfNumber number)
Description copied from class:PdfACheckerVerify the conformity of the PDF number.- Specified by:
checkPdfNumberin classPdfAChecker- Parameters:
number- thePdfNumberto check
-
getMaxRealValue
protected double getMaxRealValue()
Retrieve maximum allowed real value.- Returns:
- maximum allowed real number
-
getMaxIntegerValue
protected long getMaxIntegerValue()
Retrieve maximal allowed integer value.- Returns:
- maximal allowed integer number
-
getMinIntegerValue
protected long getMinIntegerValue()
Retrieve minimal allowed integer value.- Returns:
- minimal allowed integer number
-
checkPdfArray
protected void checkPdfArray(PdfArray array)
Description copied from class:PdfACheckerVerify the conformity of the PDF array.- Specified by:
checkPdfArrayin classPdfAChecker- Parameters:
array- thePdfArrayto check
-
checkPdfDictionary
protected void checkPdfDictionary(PdfDictionary dictionary)
Description copied from class:PdfACheckerVerify the conformity of the PDF dictionary.- Specified by:
checkPdfDictionaryin classPdfAChecker- Parameters:
dictionary- thePdfDictionaryto check
-
checkPdfStream
protected void checkPdfStream(PdfStream stream)
Description copied from class:PdfACheckerVerify the conformity of the PDF stream.- Specified by:
checkPdfStreamin classPdfAChecker- Parameters:
stream- thePdfStreamto check
-
checkPdfName
protected void checkPdfName(PdfName name)
Description copied from class:PdfACheckerVerify the conformity of the PDF name.- Specified by:
checkPdfNamein classPdfAChecker- Parameters:
name- thePdfNameto check
-
getMaxNameLength
protected int getMaxNameLength()
Retrieve maximum allowed length of the name object.- Returns:
- maximum allowed length of the name
-
checkPdfString
protected void checkPdfString(PdfString string)
Description copied from class:PdfACheckerVerify the conformity of the PDF string.- Specified by:
checkPdfStringin classPdfAChecker- Parameters:
string- thePdfStringto check
-
getMaxStringLength
protected int getMaxStringLength()
Returns maximum allowed bytes length of the string in a PDF document.- Returns:
- maximum string length
-
checkPageSize
protected void checkPageSize(PdfDictionary page)
Description copied from class:PdfACheckerChecks the allowable size of the page.- Specified by:
checkPageSizein classPdfAChecker- Parameters:
page- thePdfDictionaryof page which size being checked
-
checkFileSpec
protected void checkFileSpec(PdfDictionary fileSpec)
Description copied from class:PdfACheckerVerify the conformity of the file specification dictionary.- Specified by:
checkFileSpecin classPdfAChecker- Parameters:
fileSpec- thePdfDictionarycontaining file specification to be checked
-
checkAnnotation
protected void checkAnnotation(PdfDictionary annotDic)
Verify the conformity of the annotation dictionary.- Specified by:
checkAnnotationin classPdfAChecker- Parameters:
annotDic- the annotationPdfDictionaryto be checked
-
getForbiddenAnnotations
protected java.util.Set<PdfName> getForbiddenAnnotations()
Gets forbidden annotation types.- Returns:
- a set of forbidden annotation types
-
checkForm
protected void checkForm(PdfDictionary form)
Description copied from class:PdfACheckerVerify the conformity of the form dictionary.- Specified by:
checkFormin classPdfAChecker- Parameters:
form- the formPdfDictionaryto be checked
-
checkAction
protected void checkAction(PdfDictionary action)
Description copied from class:PdfACheckerChecks if the action is allowed.- Specified by:
checkActionin classPdfAChecker- Parameters:
action- to be checked
-
checkCatalog
protected void checkCatalog(PdfCatalog catalog)
Verify the conformity of the pdf catalog.- Specified by:
checkCatalogin classPdfAChecker- Parameters:
catalog- thePdfCatalogof trailer to check
-
checkCatalogValidEntries
protected void checkCatalogValidEntries(PdfDictionary catalogDict)
Description copied from class:PdfACheckerChecks if entries in catalog dictionary are valid.- Specified by:
checkCatalogValidEntriesin classPdfAChecker- Parameters:
catalogDict- the catalogPdfDictionaryto be checked
-
checkPageObject
protected void checkPageObject(PdfDictionary pageDict, PdfDictionary pageResources)
Description copied from class:PdfACheckerVerify the conformity of the page dictionary.- Specified by:
checkPageObjectin classPdfAChecker- Parameters:
pageDict- thePdfDictionaryto checkpageResources- the page's resources dictionary
-
checkTrailer
protected void checkTrailer(PdfDictionary trailer)
Description copied from class:PdfACheckerVerify the conformity of the trailer dictionary.- Specified by:
checkTrailerin classPdfAChecker- Parameters:
trailer- thePdfDictionaryof trailer to check
-
getFormFields
@Deprecated protected PdfArray getFormFields(PdfArray array)
Deprecated.in favour ofPdfCheckersUtil.getFormFields(PdfArray)- Parameters:
array- thePdfArrayof form fieldsPdfDictionaryobjects- Returns:
- the
PdfArrayof form fields
-
isAnnotationInvisible
private static boolean isAnnotationInvisible(int flags)
-
getMaxArrayCapacity
private int getMaxArrayCapacity()
-
getMaxDictionaryCapacity
private int getMaxDictionaryCapacity()
-
-