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 PdfConformityOperation()) {
  theOperation.Conformance = PdfConformance.PdfA1b;
  Doc theDoc = theOperation.Read(thePath, null);

  if(theOperation.Errors.Count>0) {
    for(int i = 0; i<theOperation.Errors.Count; ++i)
  if(theOperation.Warnings.Count>0) {
    for(int i = 0; i<theOperation.Warnings.Count; ++i)

[Visual Basic]
Dim thePath As String = Server.MapPath("pdfa.pdf")
Using theOperation As New PdfConformityOperation
  theOperation.Conformance = PdfConformance.PdfA1b
  Dim theDoc As Doc = theOperation.Read(thePath, Nothing)

  If theOperation.Errors.Count > 0 Then
    For i As Integer = 0 To theOperation.Errors.Count - 1
  End If
  If theOperation.Warnings.Count > 0 Then
    If theOperation.Errors.Count > 0 Then
    End If
    For i As Integer = 0 To theOperation.Warnings.Count - 1
  End If
End Using