1 year ago
#304065
vcima
How to configure WCAG2_1 in VeraPDF?
I'm trying to validate a PDF file with VeraPDF using WCAG2_1 as a validation methodology.
If I change the methodology to another such as PDFA_4, everything works fine, however with WCAG2_1 something goes wrong.
Right now I have the following:
public void test()
throws FileNotFoundException, EncryptedPdfException, ModelParsingException, ValidationException {
VeraGreenfieldFoundryProvider.initialise();
//PdfBoxFoundryProvider.initialise();
PDFAFlavour flavour = PDFAFlavour.WCAG2_1;
PDFAParser parser = Foundries.defaultInstance().createParser(new FileInputStream(
"/myfile.pdf"), flavour);
PDFAValidator validator = Foundries.defaultInstance().createValidator(flavour, true);
ValidationResult result = validator.validate(parser);
ListIterator<TestAssertion> ltr = result.getTestAssertions().listIterator();
while (ltr.hasNext()) {
System.out.println(ltr.next().getErrorMessage());
}
assertTrue(result.isCompliant());
}
pom.xml
<dependencies>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>parser</artifactId>
<version>1.21.1</version>
</dependency>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>pdf-model</artifactId>
<version>1.21.1</version>
</dependency>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>core</artifactId>
<version>1.21.1</version>
</dependency>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>verapdf-xmp-core</artifactId>
<version>1.21.1</version>
</dependency>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>validation-model</artifactId>
<version>1.21.1</version>
</dependency>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>pdfbox-validation-model</artifactId>
<version>1.21.1</version>
</dependency>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>wcag-validation</artifactId>
<version>1.21.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
</dependencies>
I have this output:
java.util.NoSuchElementException: PDFAFlavour wcag2 is not supported by this directory.
at org.verapdf.pdfa.validation.profiles.ProfileDirectoryImpl.getValidationProfileByFlavour(ProfileDirectoryImpl.java:104) at org.verapdf.pdfa.validation.validators.ValidatorFactory.createValidator(ValidatorFactory.java:69)
What can I do to support WCAG2_1 methodology?
java
wcag
0 Answers
Your Answer