Class PdfDocumentAnalyzer
Represents the analyzer of the Pdf document.
Inheritance
System.Object
PdfDocumentAnalyzer
Namespace: Syncfusion.Pdf.Parsing
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfDocumentAnalyzer : Object
Constructors
PdfDocumentAnalyzer(Stream)
Initializes a new instance of the PdfDocumentAnalyzer class with the specified stream.
Declaration
public PdfDocumentAnalyzer(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.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.
Declaration
public PdfDocumentAnalyzer(Stream stream, string password)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream containing the PDF document to analyze. |
System.String | password | 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.
Declaration
public SyntaxAnalyzerResult AnalyzeSyntax()
Returns
Type |
---|
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.
Declaration
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();