PdfDocumentAnalyzer Class
Represents the analyzer of the Pdf document.
Inheritance
System.Object
PdfDocumentAnalyzer
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Parsing
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfDocumentAnalyzer
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();
PdfDocumentAnalyzer(String)
Initializes a new instance of the PdfDocumentAnalyzer class with the specified input file path.
Declaration
public PdfDocumentAnalyzer(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | A relative or absolute path for the file. |
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();
PdfDocumentAnalyzer(String, String)
Initializes a new instance of the PdfDocumentAnalyzer class.
Declaration
public PdfDocumentAnalyzer(string fileName, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | A relative or absolute path for the file. |
System.String | password | The password (user or owner) of the encrypted document. |
Examples
string filePath = "Input.pdf";
//load the document
PdfDocumentAnalyzer analyzer = new PdfDocumentAnalyzer(filePath, "password");
//Analyze the synyax issue
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();