ValidationResult Class
Contains the result of PDF/A or PDF/UA validation.
Declaration
public class ValidationResult extends JavaObject
Remarks
PdfDocument.validatePdfA(compatibility) and PdfDocument.validatePdfUA(compatibility) methods return a ValidationResult object. Call the getIsValid() method to check whether the document conforms to the standard. Call the getIssues() method to get compliance issues.
Refer to the following help topic for additional information: Convert and Validate PDF/A and PDF/UA Documents — PDF Document API for Java.
Example
Validate a PDF Document Against PDF/A-3b
The following code snippet validates a document against PDF/A-3b and prints compliance issues:
import java.io.*;
import java.nio.file.*;
import com.devexpress.docs.pdf.*;
public class Main {
public static void main(String[] args) throws Exception {
try (InputStream inputStream = Files.newInputStream(Path.of("Document.pdf"));
PdfDocument pdfDocument = new PdfDocument(inputStream)) {
ValidationResult result = pdfDocument.validatePdfA(PdfACompatibility.PDF_A3B);
System.out.println("PDF/A-3b compliant: " + result.getIsValid());
for (ComplianceIssue issue : result.getIssues()) {
String location = issue.getPageIndex() >= 0
? "page " + (issue.getPageIndex() + 1)
: "document";
System.out.println(issue.getSeverity() + " (" + location + "), "
+ issue.getRule() + ": " + issue.getMessage());
}
}
}
}
Inherited Members
Inheritance
Methods
getIssues() Method
Returns compliance issues that the validation found.
Declaration
public List<ComplianceIssue> getIssues()
Returns
| Type | Description |
|---|---|
| java.util.List<ComplianceIssue> | Compliance issues. |
getIsValid() Method
Returns whether the document conforms to the standard.
Declaration
public boolean getIsValid()
Returns
| Type | Description |
|---|---|
| boolean |
|
Remarks
The getIsValid() method returns true if no issue in the getIssues() list has the ComplianceIssueSeverity.ERROR severity. Warnings and information messages do not affect the result.