Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.3.23
|
Leadtools.Pdf Assembly > Leadtools.Pdf Namespace > PDFDocument Class > PDFDocument Constructor : PDFDocument Constructor(Stream,String) |
'Usage
Dim stream As Stream Dim password As String Dim instance As New PDFDocument(stream, password)
The PDFDocument class encapsulates a PDF document on disk or stream and allows you to read the pages, objects and images from the document.
stream must be kept alive as long as this PDFDocument object is alive and should not be disposed. The stream can be safely disposed when this PDFDocument is disposed.
stream must contain the data of a valid PDF file. If the PDF file is encrypted, then password is used to try and decrypt the file. If the password value is not correct, an exception will be thrown. Another way of loading PDF documents is to use the PDFDocument(Stream stream) 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:
FileName: will be set to null.
Password: will be set to password regardless whether password was used when loading the file or not.
IsEncrypted: will be set false since this method cannot open an encrypted PDF file.
Resolution: will be set to the default value used to load PDF files set in the static DefaultResolution property.
Pages: will be initialized to a 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.
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(String,String) to create a PDF document from a file on disk.