Class PdfAChecker
An abstract class that will run through all necessary checks defined in the different PDF/A standards and levels.
public abstract class PdfAChecker : IValidationChecker
- Inheritance
-
PdfAChecker
- Implements
- Derived
- Inherited Members
Remarks
An abstract class that will run through all necessary checks defined in the different PDF/A standards and levels. A number of common checks are executed in this class, while standard-dependent specifications are implemented in the available subclasses. The standard that is followed is the series of ISO 19005 specifications, currently generations 1 through 3. The ZUGFeRD standard is derived from ISO 19005-3. While it is possible to subclass this method and implement its abstract methods in client code, this is not encouraged and will have little effect. It is not possible to plug custom implementations into iText, because iText should always refuse to create non-compliant PDF/A, which would be possible with client code implementations. Any future generations of the PDF/A standard and its derivates will get their own implementation in the iText - pdfa project.
Constructors
PdfAChecker(PdfAConformanceLevel)
Creates a PdfAChecker with the required conformance level.
protected PdfAChecker(PdfAConformanceLevel conformanceLevel)
Parameters
conformanceLevel
PdfAConformanceLevelthe required conformance level
Fields
ICC_COLOR_SPACE_CMYK
The Cyan-Magenta-Yellow-Key (black) color profile as defined by the International Color Consortium.
public const string ICC_COLOR_SPACE_CMYK = "CMYK"
Field Value
ICC_COLOR_SPACE_GRAY
The Grayscale color profile as defined by the International Color Consortium.
public const string ICC_COLOR_SPACE_GRAY = "GRAY"
Field Value
ICC_COLOR_SPACE_RGB
The Red-Green-Blue color profile as defined by the International Color Consortium.
public const string ICC_COLOR_SPACE_RGB = "RGB "
Field Value
ICC_DEVICE_CLASS_MONITOR_PROFILE
The Monitor device class
public const string ICC_DEVICE_CLASS_MONITOR_PROFILE = "mntr"
Field Value
ICC_DEVICE_CLASS_OUTPUT_PROFILE
The Output device class
public const string ICC_DEVICE_CLASS_OUTPUT_PROFILE = "prtr"
Field Value
checkedObjects
Contains some objects that are already checked.
protected ICollection<PdfObject> checkedObjects
Field Value
Remarks
Contains some objects that are already checked. NOTE: Not all objects that were checked are stored in that set. This set is used for avoiding double checks for actions, signatures, xObjects and page objects; and for letting those objects to be manually flushed. Use this mechanism carefully: objects that are able to be changed (or at least if object's properties that shall be checked are able to be changed) shouldn't be marked as checked if they are not to be flushed immediately.
checkedObjectsColorspace
protected IDictionary<PdfObject, PdfColorSpace> checkedObjectsColorspace
Field Value
cmykIsUsed
[Obsolete]
protected bool cmykIsUsed
Field Value
cmykUsedObjects
protected ICollection<PdfObject> cmykUsedObjects
Field Value
conformanceLevel
protected PdfAConformanceLevel conformanceLevel
Field Value
grayIsUsed
[Obsolete]
protected bool grayIsUsed
Field Value
grayUsedObjects
protected ICollection<PdfObject> grayUsedObjects
Field Value
gsStackDepth
protected int gsStackDepth
Field Value
maxGsStackDepth
The maximum Graphics State stack depth in PDF/A documents, i.e. the
maximum number of graphics state operators with code q
that
may be opened (i.e. not yet closed by a corresponding Q
) at
any point in a content stream sequence.
public const int maxGsStackDepth = 28
Field Value
Remarks
The maximum Graphics State stack depth in PDF/A documents, i.e. the
maximum number of graphics state operators with code q
that
may be opened (i.e. not yet closed by a corresponding Q
) at
any point in a content stream sequence.
Defined as 28 by PDF/A-1 section 6.1.12, by referring to the PDF spec
Appendix C table 1 "architectural limits".
pdfAOutputIntentColorSpace
protected string pdfAOutputIntentColorSpace
Field Value
pdfAOutputIntentDestProfile
protected PdfStream pdfAOutputIntentDestProfile
Field Value
rgbIsUsed
[Obsolete]
protected bool rgbIsUsed
Field Value
rgbUsedObjects
protected ICollection<PdfObject> rgbUsedObjects
Field Value
Methods
CheckAction(PdfDictionary)
Checks if the action is allowed.
protected abstract void CheckAction(PdfDictionary action)
Parameters
action
PdfDictionaryto be checked
CheckAnnotation(PdfDictionary)
Verify the conformity of the annotation dictionary.
protected abstract void CheckAnnotation(PdfDictionary annotDic)
Parameters
annotDic
PdfDictionarythe annotation PdfDictionary to be checked
CheckAppearanceStream(PdfStream)
Check single annotation appearance stream.
protected virtual void CheckAppearanceStream(PdfStream appearanceStream)
Parameters
CheckCanvasStack(char)
This method checks compliance with the graphics state architectural limitation, explained by maxGsStackDepth.
public abstract void CheckCanvasStack(char stackOperation)
Parameters
stackOperation
charthe operation to check the graphics state counter for
CheckCatalog(PdfCatalog)
Verify the conformity of the pdf catalog.
[Obsolete("Will become abstract in the next major release.")]
protected virtual void CheckCatalog(PdfCatalog catalog)
Parameters
catalog
PdfCatalogthe PdfCatalog of trailer to check.
CheckCatalogValidEntries(PdfDictionary)
Checks if entries in catalog dictionary are valid.
protected abstract void CheckCatalogValidEntries(PdfDictionary catalogDict)
Parameters
catalogDict
PdfDictionarythe catalog PdfDictionary to be checked
CheckColor(Color, PdfDictionary, bool?, PdfStream)
This method checks compliance with the color restrictions imposed by the available color spaces in the document.
[Obsolete("in favor of checkColor(CanvasGraphicsState gState, Color color, PdfDictionary currentColorSpaces, Boolean fill, PdfStream contentStream)")]
public abstract void CheckColor(Color color, PdfDictionary currentColorSpaces, bool? fill, PdfStream contentStream)
Parameters
color
Colorthe color to check
currentColorSpaces
PdfDictionarya PdfDictionary containing the color spaces used in the document
fill
bool?whether the color is used for fill or stroke operations
contentStream
PdfStreamcurrent content stream
Remarks
This method checks compliance with the color restrictions imposed by the available color spaces in the document. This method will be abstract in update 7.2
CheckColor(CanvasGraphicsState, Color, PdfDictionary, bool?, PdfStream)
This method checks compliance with the color restrictions imposed by the available color spaces in the document.
[Obsolete("This method will be abstract in next major release")]
public virtual void CheckColor(CanvasGraphicsState gState, Color color, PdfDictionary currentColorSpaces, bool? fill, PdfStream contentStream)
Parameters
gState
CanvasGraphicsStatecanvas graphics state
color
Colorthe color to check
currentColorSpaces
PdfDictionarya PdfDictionary containing the color spaces used in the document
fill
bool?whether the color is used for fill or stroke operations
contentStream
PdfStreamcurrent content stream
CheckColorSpace(PdfColorSpace, PdfDictionary, bool, bool?)
This method performs a range of checks on the given color space, depending on the type and properties of that color space.
[Obsolete("in favor of checkColorSpace(PdfColorSpace colorSpace, PdfObject object, PdfDictionary currentColorSpaces, boolean checkAlternate, Boolean fill)")]
public virtual void CheckColorSpace(PdfColorSpace colorSpace, PdfDictionary currentColorSpaces, bool checkAlternate, bool? fill)
Parameters
colorSpace
PdfColorSpacethe color space to check
currentColorSpaces
PdfDictionarya PdfDictionary containing the color spaces used in the document
checkAlternate
boolwhether or not to also check the parent color space
fill
bool?whether the color space is used for fill or stroke operations
CheckColorSpace(PdfColorSpace, PdfObject, PdfDictionary, bool, bool?)
This method performs a range of checks on the given color space, depending on the type and properties of that color space.
[Obsolete("Will become abstract in the next major release.")]
public virtual void CheckColorSpace(PdfColorSpace colorSpace, PdfObject pdfObject, PdfDictionary currentColorSpaces, bool checkAlternate, bool? fill)
Parameters
colorSpace
PdfColorSpacethe color space to check
pdfObject
PdfObjectthe pdf object to check color space in
currentColorSpaces
PdfDictionarya PdfDictionary containing the color spaces used in the document
checkAlternate
boolwhether or not to also check the parent color space
fill
bool?whether the color space is used for fill or stroke operations
CheckColorsUsages()
Verify the conformity of used color spaces.
[Obsolete("in favor of checkPageColorsUsages(PdfDictionary pageDict, PdfDictionary pageResources)")]
protected abstract void CheckColorsUsages()
CheckContentStream(PdfStream)
Attest content stream conformance with appropriate specification.
protected abstract void CheckContentStream(PdfStream contentStream)
Parameters
contentStream
PdfStreamis a content stream to validate
Remarks
Attest content stream conformance with appropriate specification. Throws PdfAConformanceException if any discrepancy was found
CheckContentStreamObject(PdfObject)
Verify the conformity of the operand of content stream with appropriate specification.
protected virtual void CheckContentStreamObject(PdfObject @object)
Parameters
object
PdfObjectis an operand of content stream to validate
Remarks
Verify the conformity of the operand of content stream with appropriate specification. Throws PdfAConformanceException if any discrepancy was found
CheckCrypto(PdfObject)
Verify the conformity of encryption usage.
[Obsolete("Will become abstract in the next major release.")]
public virtual void CheckCrypto(PdfObject crypto)
Parameters
crypto
PdfObjectEncryption object to verify.
CheckDocument(PdfCatalog)
This method checks a number of document-wide requirements of the PDF/A standard.
public virtual void CheckDocument(PdfCatalog catalog)
Parameters
catalog
PdfCatalogThe catalog being checked
Remarks
This method checks a number of document-wide requirements of the PDF/A standard. The algorithms of some of these checks vary with the PDF/A level and thus are implemented in subclasses; others are implemented as private methods in this class.
CheckExtGState(CanvasGraphicsState, PdfStream)
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.
public abstract void CheckExtGState(CanvasGraphicsState extGState, PdfStream contentStream)
Parameters
extGState
CanvasGraphicsStatethe graphics state to be checked
contentStream
PdfStreamcurrent content stream
Remarks
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
CheckFileSpec(PdfDictionary)
Verify the conformity of the file specification dictionary.
protected abstract void CheckFileSpec(PdfDictionary fileSpec)
Parameters
fileSpec
PdfDictionarythe PdfDictionary containing file specification to be checked
CheckFlag(int, int)
Checks if the specified flag is set.
protected static bool CheckFlag(int flags, int flag)
Parameters
flags
inta set of flags specifying various characteristics of the PDF object
flag
intto be checked
Returns
- bool
true if the specified flag is set
CheckFont(PdfFont)
Performs a number of checks on the font.
public abstract void CheckFont(PdfFont pdfFont)
Parameters
pdfFont
PdfFontfont to be checked
Remarks
Performs 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.
CheckFontGlyphs(PdfFont, PdfStream)
Performs a check of the each font glyph as a Form XObject.
public abstract void CheckFontGlyphs(PdfFont font, PdfStream contentStream)
Parameters
Remarks
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
CheckForm(PdfDictionary)
Verify the conformity of the form dictionary.
protected abstract void CheckForm(PdfDictionary form)
Parameters
form
PdfDictionarythe form PdfDictionary to be checked
CheckFormXObject(PdfStream)
Verify the conformity of the form XObject dictionary.
protected abstract void CheckFormXObject(PdfStream form)
Parameters
CheckImage(PdfStream, PdfDictionary)
Verify the conformity of the given image.
protected abstract void CheckImage(PdfStream image, PdfDictionary currentColorSpaces)
Parameters
image
PdfStreamthe image to check
currentColorSpaces
PdfDictionarythe PdfDictionary containing the color spaces used in the document
CheckInlineImage(PdfStream, PdfDictionary)
This method checks compliance with the inline image restrictions in the PDF/A specs, specifically filter parameters.
public abstract void CheckInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces)
Parameters
inlineImage
PdfStreama PdfStream containing the inline image
currentColorSpaces
PdfDictionarya PdfDictionary containing the color spaces used in the document
CheckLogicalStructure(PdfDictionary)
Performs a number of checks on the logical structure of the document.
protected abstract void CheckLogicalStructure(PdfDictionary catalog)
Parameters
catalog
PdfDictionarythe catalog PdfDictionary to check
CheckMetaData(PdfDictionary)
Performs a number of checks on the metadata of the document.
protected abstract void CheckMetaData(PdfDictionary catalog)
Parameters
catalog
PdfDictionarythe catalog PdfDictionary to check
CheckNonSymbolicTrueTypeFont(PdfTrueTypeFont)
Verify the conformity of the non-symbolic TrueType font.
protected abstract void CheckNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
Parameters
trueTypeFont
PdfTrueTypeFontthe PdfTrueTypeFont to check
CheckOutputIntents(PdfDictionary)
Verify the conformity of the output intents array in the catalog dictionary.
protected abstract void CheckOutputIntents(PdfDictionary catalogOrPageDict)
Parameters
catalogOrPageDict
PdfDictionarythe PdfDictionary of a catalog or page to check
CheckPageColorsUsages(PdfDictionary, PdfDictionary)
Verify the conformity of used color spaces on the page.
[Obsolete("Will become abstract in the next major release.")]
protected virtual void CheckPageColorsUsages(PdfDictionary pageDict, PdfDictionary pageResources)
Parameters
pageDict
PdfDictionarythe PdfDictionary contains contents for colors to be checked.
pageResources
PdfDictionarythe PdfDictionary contains resources for colors to be checked.
CheckPageObject(PdfDictionary, PdfDictionary)
Verify the conformity of the page dictionary.
protected abstract void CheckPageObject(PdfDictionary page, PdfDictionary pageResources)
Parameters
page
PdfDictionarythe PdfDictionary to check
pageResources
PdfDictionarythe page's resources dictionary
CheckPageSize(PdfDictionary)
Checks the allowable size of the page.
protected abstract void CheckPageSize(PdfDictionary page)
Parameters
page
PdfDictionarythe PdfDictionary of page which size being checked
CheckPageTransparency(PdfDictionary, PdfDictionary)
Verify the conformity of the page transparency.
protected abstract void CheckPageTransparency(PdfDictionary pageDict, PdfDictionary pageResources)
Parameters
pageDict
PdfDictionarythe PdfDictionary contains contents for transparency to be checked
pageResources
PdfDictionarythe PdfDictionary contains resources for transparency to be checked
CheckPdfArray(PdfArray)
Verify the conformity of the PDF array.
protected abstract void CheckPdfArray(PdfArray array)
Parameters
CheckPdfDictionary(PdfDictionary)
Verify the conformity of the PDF dictionary.
protected abstract void CheckPdfDictionary(PdfDictionary dictionary)
Parameters
dictionary
PdfDictionarythe PdfDictionary to check
CheckPdfName(PdfName)
Verify the conformity of the PDF name.
protected abstract void CheckPdfName(PdfName name)
Parameters
CheckPdfNumber(PdfNumber)
Verify the conformity of the PDF number.
protected abstract void CheckPdfNumber(PdfNumber number)
Parameters
CheckPdfObject(PdfObject)
This method checks the requirements that must be fulfilled by a COS object in a PDF/A document.
public virtual void CheckPdfObject(PdfObject obj)
Parameters
obj
PdfObjectthe COS object that must be checked
CheckPdfStream(PdfStream)
Verify the conformity of the PDF stream.
protected abstract void CheckPdfStream(PdfStream stream)
Parameters
CheckPdfString(PdfString)
Verify the conformity of the PDF string.
protected abstract void CheckPdfString(PdfString @string)
Parameters
CheckRenderingIntent(PdfName)
Checks whether the rendering intent of the document is within the allowed range of intents.
public abstract void CheckRenderingIntent(PdfName intent)
Parameters
intent
PdfNamethe intent to be analyzed
Remarks
Checks 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.
CheckResources(PdfDictionary)
Verify the conformity of the resources dictionary.
[Obsolete("in favor of checkResources(PdfDictionary resources, PdfObject pdfObject)")]
protected virtual void CheckResources(PdfDictionary resources)
Parameters
resources
PdfDictionarythe PdfDictionary to be checked
CheckResources(PdfDictionary, PdfObject)
Verify the conformity of the resources dictionary.
protected virtual void CheckResources(PdfDictionary resources, PdfObject pdfObject)
Parameters
resources
PdfDictionarythe PdfDictionary to be checked
pdfObject
PdfObjectthe pdf object to check resources for
CheckResourcesOfAppearanceStreams(PdfDictionary)
Checks resources of the appearance streams.
protected virtual void CheckResourcesOfAppearanceStreams(PdfDictionary appearanceStreamsDict)
Parameters
appearanceStreamsDict
PdfDictionarythe dictionary with appearance streams to check.
CheckSignature(PdfDictionary)
This method checks compliance of the signature dictionary
public virtual void CheckSignature(PdfDictionary signatureDict)
Parameters
signatureDict
PdfDictionarya PdfDictionary containing the signature.
CheckSignatureType(bool)
This method checks compliance of the signature type
[Obsolete("Will become abstract in the next major release.")]
public virtual void CheckSignatureType(bool isCAdES)
Parameters
isCAdES
booltrue is CAdES sig type is used, false otherwise.
CheckSinglePage(PdfPage)
This method checks all requirements that must be fulfilled by a page in a PDF/A document.
public virtual void CheckSinglePage(PdfPage page)
Parameters
page
PdfPagethe page that must be checked
CheckStructure(PdfAConformanceLevel)
Checks conformance level of PDF/A standard.
protected static bool CheckStructure(PdfAConformanceLevel conformanceLevel)
Parameters
conformanceLevel
PdfAConformanceLevelthe PdfAConformanceLevel to be checked
Returns
- bool
true if the specified conformanceLevel is
a
for PDF/A-1, PDF/A-2 or PDF/A-3
CheckSymbolicTrueTypeFont(PdfTrueTypeFont)
Verify the conformity of the symbolic TrueType font.
protected abstract void CheckSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
Parameters
trueTypeFont
PdfTrueTypeFontthe PdfTrueTypeFont to check
CheckTagStructureElement(PdfObject)
This method checks compliance of the tag structure elements, such as struct elements or parent tree entries.
public virtual void CheckTagStructureElement(PdfObject obj)
Parameters
obj
PdfObjectan object that represents tag structure element.
CheckText(string, PdfFont)
Verify the conformity of the text written by the specified font.
[Obsolete("Will become abstract in the next major release.")]
public virtual void CheckText(string text, PdfFont font)
Parameters
CheckTrailer(PdfDictionary)
Verify the conformity of the trailer dictionary.
protected abstract void CheckTrailer(PdfDictionary trailer)
Parameters
trailer
PdfDictionarythe PdfDictionary of trailer to check
CheckXrefTable(PdfXrefTable)
Verify the conformity of the cross-reference table.
public abstract void CheckXrefTable(PdfXrefTable xrefTable)
Parameters
xrefTable
PdfXrefTableis the Xref table
GetAllowedNamedActions()
Retrieve allowed actions in conforming document.
protected abstract ICollection<PdfName> GetAllowedNamedActions()
Returns
- ICollection<PdfName>
set of PdfName with allowed named actions
GetConformanceLevel()
Gets the PdfAConformanceLevel for this file.
public virtual PdfAConformanceLevel GetConformanceLevel()
Returns
- PdfAConformanceLevel
the defined conformance level for this document.
GetForbiddenActions()
Retrieve forbidden actions in conforming document.
protected abstract ICollection<PdfName> GetForbiddenActions()
Returns
- ICollection<PdfName>
set of PdfName with forbidden actions
GetMaxNumberOfIndirectObjects()
Retrieve maximum allowed number of indirect objects in conforming document.
protected abstract long GetMaxNumberOfIndirectObjects()
Returns
- long
maximum allowed number of indirect objects
IsAlreadyChecked(PdfDictionary)
Checks whether the specified dictionary was already checked.
protected virtual bool IsAlreadyChecked(PdfDictionary dictionary)
Parameters
dictionary
PdfDictionarythe PdfDictionary to check
Returns
- bool
true if the specified dictionary was checked
IsContainsTransparencyGroup(PdfDictionary)
Checks whether the specified dictionary has a transparency group.
protected static bool IsContainsTransparencyGroup(PdfDictionary dictionary)
Parameters
dictionary
PdfDictionarythe PdfDictionary to check
Returns
- bool
true if and only if the specified dictionary has a Group key and its value is a dictionary with Transparency subtype
IsFullCheckMode()
In full check mode all objects will be tested for ISO conformance.
public virtual bool IsFullCheckMode()
Returns
- bool
true if full check mode is switched on
Remarks
In full check mode all objects will be tested for ISO conformance. If full check mode is switched off objects which were not modified might be skipped to speed up the validation of the document
- See Also
ObjectIsChecked(PdfObject)
Remembers which objects have already been checked, in order to avoid redundant checks.
public virtual bool ObjectIsChecked(PdfObject @object)
Parameters
object
PdfObjectthe object to check
Returns
- bool
whether or not the object has already been checked
SetFullCheckMode(bool)
In full check mode all objects will be tested for ISO conformance.
public virtual void SetFullCheckMode(bool fullCheckMode)
Parameters
fullCheckMode
boolis a new value for full check mode switcher
Remarks
In full check mode all objects will be tested for ISO conformance. If full check mode is switched off objects which were not modified might be skipped to speed up the validation of the document
- See Also
SetPdfAOutputIntentColorSpace(PdfDictionary)
Set Pdf A output intent color space.
public virtual void SetPdfAOutputIntentColorSpace(PdfDictionary catalog)
Parameters
catalog
PdfDictionaryCatalog dictionary to retrieve the color space from.
ValidateDocument(ValidationContext)
public virtual void ValidateDocument(ValidationContext validationContext)
Parameters
validationContext
ValidationContext
ValidateObject(object, IsoKey, PdfResources, PdfStream, object)
public virtual void ValidateObject(object obj, IsoKey key, PdfResources resources, PdfStream contentStream, object extra)
Parameters
obj
objectkey
IsoKeyresources
PdfResourcescontentStream
PdfStreamextra
object