←Select platform

PDFDocument Constructor(string,string)

Summary

Initializes a new PDFDocument form a specified PDF file and optional password.

Syntax

C#
VB
Java
C++
public PDFDocument( 
   string fileName, 
   string password 
) 
Public Function New( _ 
   ByVal fileName As String, _ 
   ByVal password As String _ 
) 
public PDFDocument(String fileName, String password) 
public: 
PDFDocument(  
   String^ fileName, 
   String^ password 
) 

Parameters

fileName
The name of an existing PDF file.

password
The password to use if fileName contains an encrypted PDF file.

Remarks

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:

Use PDFDocument Constructor(stream,string) to create a PDF document from a .NET stream.

Example

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.

 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Pdf Assembly