Table of Contents

Class PdfDocumentAnalyzer

Namespace
Syncfusion.Pdf.Parsing
Assembly
Syncfusion.Pdf.Portable.dll

Represents the analyzer of the Pdf document.

public class PdfDocumentAnalyzer
Inheritance
PdfDocumentAnalyzer
Inherited Members

Constructors

PdfDocumentAnalyzer(Stream)

Initializes a new instance of the PdfDocumentAnalyzer class with the specified stream.

public PdfDocumentAnalyzer(Stream stream)

Parameters

stream Stream

The stream containing the PDF document to analyze.

Examples

string filePath = "Input.pdf";      
Stream streamFile = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read, FileShare.Read);   
load the stream
PdfDocumentAnalyzer analyzer = new PdfDocumentAnalyzer(streamFile);
//Analyze syntax issues.
SyntaxAnalyzerResult analyzerResult = analyzer.AnalyzeSyntax();        
 if(analyzerResult.IsCorrupted)
 {
     throw new Exception("The document is corrupt");
 }
 analyzer.Close();

PdfDocumentAnalyzer(Stream, string)

Initializes a new instance of the PdfDocumentAnalyzer class.

public PdfDocumentAnalyzer(Stream stream, string password)

Parameters

stream Stream

The stream containing the PDF document to analyze.

password string

The password (user or owner) of the encrypted document.

Examples

string filePath = "Input.pdf";      
Stream streamFile = new FileStream("Input.pdf", FileMode.Open, FileAccess.Read, FileShare.Read);   
load the stream with password
PdfDocumentAnalyzer analyzer = new PdfDocumentAnalyzer(streamFile, "passsword");
//Analyze the syntax issues.
SyntaxAnalyzerResult analyzerResult = analyzer.AnalyzeSyntax();       
 if(analyzerResult.IsCorrupted)
 {
 throw new Exception("The document is corrupt");
 }
 analyzer.Close();

Methods

AnalyzeSyntax()

Analyze the given PDF file and check whether any syntax issues found.

public SyntaxAnalyzerResult AnalyzeSyntax()

Returns

SyntaxAnalyzerResult

Examples

string filePath = "Input.pdf";   
//load the document
PdfDocumentAnalyzer analyzer = new PdfDocumentAnalyzer(filePath);
//Analyze the synyax issue
SyntaxAnalyzerResult analyzerResult = analyzer.AnalyzeSyntax();          
 if(analyzerResult.IsCorrupted)
 {
   throw new Exception("The document is corrupt");
 }
 analyzer.Close();

Close()

Close the PdfDocumentAnalyzer class.

public void Close()

Examples

string filePath = "Input.pdf";   
//load the document
PdfDocumentAnalyzer analyzer = new PdfDocumentAnalyzer(filePath);
//Analyze the syntax issues.
SyntaxAnalyzerResult analyzerResult = analyzer.AnalyzeSyntax();        
 if(analyzerResult.IsCorrupted)
 {
 throw new Exception("The document is corrupt");
 }
 analyzer.Close();