Skip to content

About

PdfAValidatorApi wraps calls to VeraPdf

Resources

Stars

11 stars

Watchers

1 watching

Forks

Repository files navigation

Codeuctivity.PdfAValidator

Build Nuget Donate

PdfAValidatorApi wraps calls to VeraPdf. Access VeraPdf from your unit tests or integrate it into your micro architecture. Works on Windows, Linux and MacOs.

Sample - e.g. use it in your unit test to check compliance of some pdf:

public static async Task ShouldDetectCompliantPdfA()
{
    using var pdfAValidator = new PdfAValidator();
    var result = await pdfAValidator.ValidateAsync("./TestPdfFiles/FromLibreOffice.pdf");
    Assert.True(result);
}

Sample - e.g. use it in your unit test to check the used sub standard of some pdf:

public static async Task ShouldGetDetailedReportFromPdfA()
{
    using var pdfAValidator = new PdfAValidator();
    var result = await pdfAValidator.ValidateWithDetailedReportAsync("./TestPdfFiles/FromLibreOffice.pdf");
    Assert.True(result.Jobs.Job.ValidationReport.IsCompliant);
    Assert.True(result.Jobs.Job.ValidationReport.ProfileName == "PDF/A-1a validation profile");
}

Sample - e.g. use it in your unit test to check PDF meta data:

 public static async Task ShouldGetFeaturesReportWhenAskingForIt()
 {
     using var pdfAValidator = new PdfAValidator();
     var result = await pdfAValidator.ValidateWithDetailedReportAsync("./TestPdfFiles/FromLibreOffice.pdf", "--extract informationDict");
     var producerEntry = result.Jobs.Job.FeaturesReport.InformationDict.Entries.Single(e => e.Key == "Producer");
     Assert.Equal("LibreOffice 6.1", producerEntry.Value);
 }

Dependencies

Windows

Everything comes with the nuget package

Linux and macOS

Needs a Java runtime (8 or newer). veraPDF finds Java via JAVA_HOME or the PATH.

Ubuntu:

sudo apt install default-jre

macOS:

brew install openjdk

Third-party components

This package bundles veraPDF (GPL-3.0-or-later / MPL-2.0) and, for Windows, an OpenJDK 8 JRE (GPL-2.0 with Classpath Exception). See THIRD-PARTY-NOTICES.md for licenses and source code.

Development dependencies

The build downloads and installs veraPDF (see VeraPdfVersion in PdfAValidator/PdfAValidator.csproj), so a Java runtime must be on the PATH or set via JAVA_HOME when building.

About

PdfAValidatorApi wraps calls to VeraPdf

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages