Here we validate a document against PDF/A-1b format.
string path = Server.MapPath("pdfa.pdf");
using (var op = new PdfValidationOperation()) {
op.Conformance = PdfConformance.PdfA1b;
using var doc = op.Read(path, null);
if (op.Errors.Count > 0) {
Console.WriteLine("Errors:");
for (int i = 0; i < op.Errors.Count; ++i)
Console.WriteLine(op.Errors[i]);
}
if (op.Warnings.Count > 0) {
if (op.Errors.Count > 0)
Console.WriteLine();
Console.WriteLine("Warnings:");
for (int i = 0; i < op.Warnings.Count; ++i)
Console.WriteLine(op.Warnings[i]);
}
}
Dim thePath As String = Server.MapPath("pdfa.pdf")
Using theOperation As New PdfValidationOperation()
theOperation.Conformance = PdfConformance.PdfA1b
Dim doc As Doc = theOperation.Read(thePath, Nothing)
doc.Dispose()
If theOperation.Errors.Count > 0 Then
Console.WriteLine("Errors:")
Dim i As Integer = 0
While i < theOperation.Errors.Count
Console.WriteLine(theOperation.Errors(i))
System.Threading.Interlocked.Increment(i)
End While
End If
If theOperation.Warnings.Count > 0 Then
If theOperation.Errors.Count > 0 Then
Console.WriteLine()
End If
Console.WriteLine("Warnings:")
Dim i As Integer = 0
While i < theOperation.Warnings.Count
Console.WriteLine(theOperation.Warnings(i))
System.Threading.Interlocked.Increment(i)
End While
End If
End Using