Read and validate an existing document.




Doc Read(string path, XReadOptions options)
Doc Read(byte[] data, XReadOptions options)
Doc Read(Stream stream, XReadOptions options)

[Visual Basic]
Function Read(path As String, options As XReadOptions) As Doc
Function Read(data() As Byte, options As XReadOptions) As Doc
Function Read(stream As Stream, options As XReadOptions) As Doc

Throws Exceptions may throw Exception()



Name Description
path The file path to PDF document.
data The source PDF data.
stream The source PDF stream.
options The settings for the read. (May be null.)




This method reads and validates the document according to the Conformance property. Any conformance error or warning is reported in the Errors property or the Warnings property after the method finishes.

If the Doc property is null, the document is read into a new Doc object, which is returned; otherwise, the document is read into the value of the Doc property, which is returned.




Here we validate a document against PDF/A-1b format.


string thePath = Server.MapPath("pdfa.pdf"); using (PdfValidationOperation theOperation = new PdfValidationOperation()) {   theOperation.Conformance = PdfConformance.PdfA1b;   Doc doc = theOperation.Read(thePath, null);   doc.Dispose();   if (theOperation.Errors.Count > 0) {     Console.WriteLine("Errors:");     for (int i = 0; i < theOperation.Errors.Count; ++i)       Console.WriteLine(theOperation.Errors[i]);   }   if (theOperation.Warnings.Count > 0) {     if (theOperation.Errors.Count > 0)       Console.WriteLine();     Console.WriteLine("Warnings:");     for (int i = 0; i < theOperation.Warnings.Count; ++i)       Console.WriteLine(theOperation.Warnings[i]);   } }