Skip to content

PdfAValidatorApi wraps calls to VeraPdf in a .net standard assembly and as WebApi. Access VeraPdf from your Unittests or integrate it into your micorarchitecture.

License

Notifications You must be signed in to change notification settings

Codeuctivity/PdfAValidatorApi

Repository files navigation

Codeuctivity.PdfAValidator

Build Nuget Donate

PdfAValidatorApi wraps calls to VeraPdf in a .net standard assembly and as WebApi. 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);
 }

Demo OpenApi - PdfAValidatorWebApi

Give https://pdfavalidator.azurewebsites.net a try, but don't be disappointed if it is off-line. The demo azure account is running on limited budget.

Dependencies

Windows

Everything comes with the nuget package

Ubuntu

Current PdfAValidatorApi depends on openjdk-11-jre and some .net version.

sudo apt install openjdk-11-jre
sudo update-alternatives --config java

Development dependencies

Setup .net sdk ubuntu 22.04

sudo apt install dotnet6

About

PdfAValidatorApi wraps calls to VeraPdf in a .net standard assembly and as WebApi. Access VeraPdf from your Unittests or integrate it into your micorarchitecture.

Resources

License

Stars

Watchers

Forks

Packages

No packages published