Class PdfUAValidationContext
- java.lang.Object
-
- com.itextpdf.pdfua.checkers.utils.PdfUAValidationContext
-
public class PdfUAValidationContext extends java.lang.Object
This class keeps track of useful information when validating a PdfUaDocument. It also contains some useful utility functions that help with PDF UA validation.
-
-
Field Summary
Fields Modifier and Type Field Description private PdfDocument
pdfDocument
-
Constructor Summary
Constructors Constructor Description PdfUAValidationContext(PdfDocument pdfDocument)
Creates a new instance ofPdfUAValidationContext
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfObjRef
findObjRefByStructParentIndex(int i, PdfDictionary pageDict)
Retrieves object reference instance by provided structure parent index.PdfStructElem
getElementIfRoleMatches(PdfName role, IStructureNode structureNode)
Checks if aIStructureNode
resolved role's is equal to the provided role.PdfUAConformance
getUAConformance()
Retrieves the PDF/UA conformance of thePdfDocument
.java.lang.String
resolveToStandardRole(IStructureNode node)
Resolves the node's role to a standard role.java.lang.String
resolveToStandardRole(java.lang.String role)
Resolves the role to a standard role.java.lang.String
resolveToStandardRole(java.lang.String role, PdfNamespace namespace)
Resolves the role to a standard role.
-
-
-
Field Detail
-
pdfDocument
private final PdfDocument pdfDocument
-
-
Constructor Detail
-
PdfUAValidationContext
public PdfUAValidationContext(PdfDocument pdfDocument)
Creates a new instance ofPdfUAValidationContext
.- Parameters:
pdfDocument
- thePdfDocument
instance that is being validated
-
-
Method Detail
-
resolveToStandardRole
public java.lang.String resolveToStandardRole(IStructureNode node)
Resolves the node's role to a standard role.- Parameters:
node
- The node you want to resolve the standard role for.- Returns:
- The role.
-
resolveToStandardRole
public java.lang.String resolveToStandardRole(java.lang.String role)
Resolves the role to a standard role.- Parameters:
role
- the role you want to resolve the standard role for- Returns:
- resolved role
-
resolveToStandardRole
public java.lang.String resolveToStandardRole(java.lang.String role, PdfNamespace namespace)
Resolves the role to a standard role.- Parameters:
role
- the role you want to resolve the standard role fornamespace
- namespace where role is defined- Returns:
- resolved role
-
getElementIfRoleMatches
public PdfStructElem getElementIfRoleMatches(PdfName role, IStructureNode structureNode)
Checks if aIStructureNode
resolved role's is equal to the provided role.Note: This method will not check recursive mapping. So either the node's role is the provided role, or the standard role is the provided role. So we do not take into account the roles in between the mappings.
- Parameters:
role
- The role we want to check against.structureNode
- The structure node we want to check.- Returns:
- The
PdfStructElem
if the role matches.
-
findObjRefByStructParentIndex
public PdfObjRef findObjRefByStructParentIndex(int i, PdfDictionary pageDict)
Retrieves object reference instance by provided structure parent index.- Parameters:
i
- index of the structure parentpageDict
-PdfDictionary
of the page thatPdfObjRef
belong to- Returns:
PdfObjRef
instance
-
getUAConformance
public PdfUAConformance getUAConformance()
Retrieves the PDF/UA conformance of thePdfDocument
.- Returns:
PdfUAConformance
value
-
-