Home : PDF : PDF Metadata : Using PdfDocument Examiner
Q10421 - INFO: Using PdfDocument Examiner

Starting in 10.4, DotImage's PdfDocument components have a new Examiner tool. It allows a very fast, low-overhead means to probe a PDF to ascertain useful information such as whether the file is a valid PDF, if it contains certain structures or types that we do not support, if it has forms data, etc.

Making use of Examiner

First, you will need to make sure to add a reference to Atalasoft.PdfDoc.dll to your project.

You will need a license for DotImage Document Imaging or DotPdf to use this component (you do NOT need a license for PdfReader to use Examiner)

add the required using/Imports statement

C#:
using Atalasoft.PdfDoc.Examiner;

VB.NET:
Imports Atalasoft.PdfDoc.Examiner

Now, you're ready to use the Examiner to analyze the PDF - you'll need a stream to pass to it. Support strongly suggests that you wrap your stream in a using statement as this will guarantee you don't leave a file handle open on your PDF file accidentally.

C#:

using (FileStream fs = new FileStream(@"Path\to\target.pdf", FileMode.Open))
{
   
ExaminerResults res = ExaminerResults.FromStream(fs, null, null);

    // you can now access various properties of the results to check for desired attributes
}

VB.NET:

Using fs As New FileStream("Path\to\target.pdf", FileMode.Open)

    Dim  
res As ExaminerResults = ExaminerResults.FromStream(fs, Nothing, Nothing)

    ' you can now access various properties of the results to check for desired attributes

End Using

Sample Project

PdfDocExaminerExample.zip is attached to this article - it's a simple console app that shows a practical implementation this component.

Related Articles
No Related Articles Available.

Article Attachments
PdfDocExaminerExample.zip

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2017. InstantASP Ltd. All Rights Reserved