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");
var producerEntry = result.Jobs.Job.FeaturesReport.InformationDict.Entries.Single(e => e.Key == "Producer");
Assert.Equal("LibreOffice 6.1", producerEntry.Value);
}
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.
Everything comes with the nuget package
Current PdfAValidatorApi depends on openjdk-11-jre and some .net version.
sudo apt install openjdk-11-jre
sudo update-alternatives --config java
sudo apt install dotnet6