Class PdfAValidator
Validates PDF documents against the PDF/A archival format (ISO 19005) and reports the result as a machine-readable verdict with stable, per-rule findings.
public static class PdfAValidator
- Inheritance
-
PdfAValidator
- Inherited Members
Examples
Example 1: Validate a file against its declared level.
using LMKit.Document.Pdf;
var report = PdfAValidator.Validate("invoice_pdfa.pdf");
Console.WriteLine($"{report.Verdict} ({report.Validator})");
foreach (var finding in report.Findings)
{
Console.WriteLine($" {finding.Rule}: {finding.Description}");
}
Example 2: Convert, then verify the output independently.
using LMKit.Document.Pdf;
var converted = PdfAConverter.ConvertToBytes(sourceBytes);
var report = await PdfAValidator.ValidateAsync(converted.Data);
bool verified = report.Verdict == PdfAValidationVerdict.Compliant;
Remarks
Independent by construction. The validator re-parses the candidate bytes from scratch and evaluates the rule catalog against the document's actual state; it never trusts producer bookkeeping. It can therefore check files produced by PdfAConverter as well as files of unknown origin, and tell a file that merely declares PDF/A from one that holds up to the rules.
Levels. The B (basic) profiles of PDF/A-1, PDF/A-2 and PDF/A-3 are covered. With no explicit Level the level is resolved from the file's own XMP identification; a file declaring a part outside this coverage (e.g. PDF/A-4) yields Undetermined, never a false verdict.
Verdicts. Compliant means every evaluated rule passed; NonCompliant carries one PdfAValidationFinding per failed rule; Undetermined means the document could not be judged (unreadable, password required, uncovered level). RulesEvaluated states the pass's own coverage so stored verdicts stay honest.
Methods
- Validate(Attachment, PdfAValidationOptions, CancellationToken)
Validates the PDF carried by
attachment.
- Validate(byte[], PdfAValidationOptions, CancellationToken)
Validates in-memory PDF bytes.
- Validate(Stream, PdfAValidationOptions, CancellationToken)
Validates the PDF read from
inputStream.
- Validate(string, PdfAValidationOptions, CancellationToken)
Validates the PDF at
inputPath.
- ValidateAsync(Attachment, PdfAValidationOptions, CancellationToken)
Asynchronously validates the PDF carried by
attachment.
- ValidateAsync(byte[], PdfAValidationOptions, CancellationToken)
Asynchronously validates in-memory PDF bytes.
- ValidateAsync(Stream, PdfAValidationOptions, CancellationToken)
Asynchronously validates the PDF read from
inputStream.
- ValidateAsync(string, PdfAValidationOptions, CancellationToken)
Asynchronously validates the PDF at
inputPath.