Class PdfCheckersUtil
- java.lang.Object
-
- com.itextpdf.kernel.utils.checkers.PdfCheckersUtil
-
public final class PdfCheckersUtil extends java.lang.ObjectUtility class that contains common checks used in both PDF/A and PDF/UA modules.
-
-
Constructor Summary
Constructors Modifier Constructor Description privatePdfCheckersUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancheckFlag(int flags, int flag)Checks if the specified flag is set.static voidcheckMetadata(PdfDictionary catalog, PdfConformance conformance, java.util.function.Function<java.lang.String,PdfException> exceptionSupplier)Checks that theCatalogdictionary of a conforming file contains theMetadatakey whose value is a metadata stream as defined in ISO 32000-2:2020.static PdfArraygetFormFields(PdfArray array)Gets all the descending kids including widgets for a givenPdfArrayrepresenting array of form fields.private static booleanisValidXmpRevision(java.lang.String value)Validatespdfuaid:revvalue which is four-digit year of the date of publication or revision.static voidvalidateLang(PdfDictionary catalogDict, java.util.function.Function<java.lang.String,PdfException> exceptionSupplier)Checks that natural language is declared using the methods described in ISO 32000-2:2020, 14.9.2 or ISO 32000-1:2008, 14.9.2 (same requirements).
-
-
-
Method Detail
-
validateLang
public static void validateLang(PdfDictionary catalogDict, java.util.function.Function<java.lang.String,PdfException> exceptionSupplier)
Checks that natural language is declared using the methods described in ISO 32000-2:2020, 14.9.2 or ISO 32000-1:2008, 14.9.2 (same requirements).- Parameters:
catalogDict-PdfDictionarydocument catalog dictionary containingLangentry to checkexceptionSupplier-Function<String, PdfException>in order to provide correct exception
-
checkMetadata
public static void checkMetadata(PdfDictionary catalog, PdfConformance conformance, java.util.function.Function<java.lang.String,PdfException> exceptionSupplier)
Checks that theCatalogdictionary of a conforming file contains theMetadatakey whose value is a metadata stream as defined in ISO 32000-2:2020. Also checks that the value of eitherpdfuaid:partorpdfaid:partis the provided one for conforming PDF files and validates requiredpdfuaid:revorpdfaid:revvalue.For PDF/UA, checks that the
Metadatastream as specified in ISO 32000-2:2020, 14.3 in the document catalog dictionary includes adc:titleentry reflecting the title of the document.For PDF/A, checks that
pdfa:conformancevalue is correct if specified.- Parameters:
catalog-PdfDictionarydocument catalog dictionaryconformance- either PDF/A or PDF/UA conformance to checkexceptionSupplier-Function<String, PdfException>in order to provide correct exception
-
getFormFields
public static PdfArray getFormFields(PdfArray array)
Gets all the descending kids including widgets for a givenPdfArrayrepresenting array of form fields.- Parameters:
array- thePdfArrayof form fieldsPdfDictionaryobjects- Returns:
- the
PdfArrayof all form fields
-
isValidXmpRevision
private static boolean isValidXmpRevision(java.lang.String value)
Validatespdfuaid:revvalue which is four-digit year of the date of publication or revision.- Parameters:
value-pdfuaid:revvalue to check- Returns:
trueifpdfuaid:revvalue is valid,falseotherwise
-
checkFlag
public static boolean checkFlag(int flags, int flag)Checks if the specified flag is set.- Parameters:
flags- a set of flags specifying various characteristics of the PDF objectflag- to be checked- Returns:
trueif the specified flag is set,falseotherwise
-
-