Skip to main content

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

com.devexpress.system.JavaObject.clone()
com.devexpress.system.JavaObject.equals(java.lang.Object)
com.devexpress.system.JavaObject.hashCode()
com.devexpress.system.JavaObject.initFields()
com.devexpress.system.JavaObject.memberwiseClone()
com.devexpress.system.JavaObject.toString()
java.lang.Object.finalize()
java.lang.Object.getClass()
java.lang.Object.notify()
java.lang.Object.notifyAll()
java.lang.Object.wait()
java.lang.Object.wait(long)
java.lang.Object.wait(long,int)

Inheritance

Object
com.devexpress.system.JavaObject
ValidationResult

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

true if the validation found no errors; otherwise, false.

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.