PdfManager Object


PdfManager is AspPDF.NET's central top-level object. It serves as an "object factory" for other objects, most notably PdfDocument. It also provides registration key-related functionality.

Member List


DateTime Expires (Read-only)
Returns the component's expiration date obtained from the registration key in use. If the returned value is 9/9/9999, it means the registration key is permanent.

string Version (Read-only)
Returns the current component version in the format "X.X.X.X Build XXXX", for example " Build 13567".

string RegKey (Write-only)

Specifies the registration key. If this property is not set, AspPDF.NET will look for a registration key in the current .config file in the <appSettings> section under the name AspPDF_RegKey. If the key is invalid, this property will throw an error exception. AspPDF.NET requires a registration key even for evaluation purposes. A free 30-day evaluation key can be obtained here.

For more information, see Section 1.5 - Expiration Mechanism.


PdfDocument CreateDocument()
PdfDocument CreateDocument(string ID)

Creates an empty PDF document, returns an instance of the PdfDocument object representing this document.

ID is a binary number, specified as a hex string, to be used as this document's identifier. If this argument is omitted, AspPDF.NET will generate a random 128-bit document identifier. Use this argument only if you need your document to have a specific identifier for accountability or other purposes. The current document identifier can be retrieved via PdfDocument's ID property.

PdfParam CreateParam()
PdfParam CreateParam(string ParamStr)

Creates an instance of the PdfParam object optionally initialized with a parameter string specified by ParamStr. If the ParamStr argument is omitted, the method creates an empty PdfParam object.

For more information about the PdfParam object and parameter strings, see Section 2.3 - PdfParam Object.

string InjectTextIntoFile(string Path, string Text, int Location)

An auxiliary method which places UTF-8 encoded Text into a file specified by Path at a location specified by Location. Returns the filename (without the path) of the file specified by Path.

Use this method to inject a digitial signature generated on a user workstation into a server-side PDF. This functionality is described in Section 8.4 - Client-Side Signing of Server-Side PDFs.

This method was introduced in Version 3.4.

string LoadTextFromFile(string Path)

An auxiliary method which loads a text string from a file specified by Path. A file can be in ANSI or Unicode (little endian or big endian) formats.

All text-handling method such as PdfCanvas.DrawText expect a text string to be passed as an argument. If the text to be drawn resides in a file, the LoadTextFromFile method can be used to load the file into a text string which can them be passed to a text-drawing method.

void LogonUser(string Domain, string Username, string Password)

Impersonates the specified user account. If Domain is empty, the local computer will be used to validate the password. Use this function if your current security context does not allow you to perform a certain operation such as sending an image to the network printer.

PdfDocument OpenDocument(string Path)
PdfDocument OpenDocument(string Path, string Password)
PdfDocument OpenDocument(byte [] Blob)
PdfDocument OpenDocument(byte [] Blob, string Password)

Opens an existing PDF document from a file specified by Path. Password optionally specifies an owner or user password in case the document is password-protected.

Generally, the method returns an instance of the PdfDocument object representing the document being opened. If the document is password-protected and Password is missing, the method returns null. If a password is required and an invalid one is specified, or if the file being opened is invalid or corrupt, the method throws an error exception.

For more information about working with existing documents, see Chapter 9 - Working with Existing PDFs.

void RevertToSelf()
Ends impersonation begun by LogonUser.

void SendBinary(string Path)
void SendBinary(string Path, string ContentType, string DispHeader)

Sends an arbitrary file specified via Path from the server's hard drive to the client browser. This method can only be used under ASP.NET.

A script calling this method must not have any HTML tags in it (not even comments) as they would corrupt the HTTP stream.

ContentType optionally specifies the Content-Type header for the HTTP stream. This argument is "application/pdf" by default.

DispHeader optionally specifies the Content-Disposition header for the HTTP stream. By default, the header is set to "attachment; filename=filename.ext" based on the name of the file being sent. You may choose to pass a value for this argument if you want to specify a filename other than the actual document name.


objPDF.SendBinary( @"c:\path\a.pdf", null, "attachment; filename=b.pdf" );