Initializes a new PDFDocument form a specified PDF file and optional password.
The name of an existing PDF file.
The password to use if fileName contains an encrypted PDF file.
The PDFDocument class encapsulates a PDF document on disk and allows you to read the pages, objects and images from the document. fileName must contain the name of an existing and valid PDF file on disk. If the PDF file is encrypted, then password is used to try and decrypt the file. If the password value is not correct, and exception will be thrown. Another way of loading PDF documents is to use the PDFDocument(string fileName) constructor. This constructor does not work on encrypted PDF files. Use the PDFFile.IsEncrypted to determine whether a PDF file is encrypted.
This method will initialize the members of PDFDocument as follows:
IsEncrypted: will be set to false since this method cannot open an encrypted PDF file.
Pages: will be initialized to list of PDFDocumentPage objects, one item for each page found in the PDF document. Not all of the PDFDocumentPage members will be initialized since the PDFDocument constructor does not read any PDF objects by default. Refer to PDFDocumentPage for more information.
DocumentProperties: will be initialized with PDF document properties or metadata read from the file.
SecurityOptions: will be initialized with PDF document security and encryption options read from the file.
FileType: will be initialized with PDF document file type or version read from the file.
InternalLinks: will be initialized to null. The PDFDocument constructor will not read the PDF document structure by default. Instead, use the ParseDocumentStructure method to read the structure and populate InternalLinks.
Bookmarks: will be initialized to null. The PDFDocument constructor will not read the PDF document structure by default. Instead, use the ParseDocumentStructure method to read the structure and populate Bookmarks.
Use PDFDocument Constructor(stream,string) to create a PDF document from a .NET stream.
This example will determine whether a PDF file is encrypted. If it is, the user is asked for a password before the document is loaded.
Medical Web Viewer .NET