Adobe ColdFusion 8

Setting passwords

ColdFusion supports two types of passwords: an owner password and a user password. An owner password controls the ability to change the permissions on a document. When you specify an owner password, you set permissions to restrict the operations users can perform, such as the ability to print a document, make changes to its content, and extract content. The following code creates an owner password for a document:

<cfpdf action="protect" newOwnerPassword="splunge" source="timesheet.pdf"
    destination="timesheet.pdf" overwrite="yes" permissions="AllowPrinting">

To password-protect a document, set the user password. A user password controls the ability to open a document. If you set a user password for a document, any person attempting to open the file is prompted to enter a password. The following example sets the user password for a document:

<cfpdf action="protect" newUserPassword="openSesame" source="timesheet.pdf"
    destination="myTimesheet.pdf">

In the previous example, no restrictions apply to the PDF document after the user enters the correct password. To restrict usage and password-protect a document, add a user password and an owner password. Use the owner password to set the permissions, as the following example shows:

<cfpdf action="protect" newUserPassword="openSesame" newOwnerPassword="topSecret"
    source="timesheet.pdf" destination="myTimesheet.pdf" overwrite="yes"
    permissions="AllowPrinting>

In the previous example, a person who enters the user password (openSesame) can print the document only. A person who enters the owner password (topSecret) is considered the owner of the document, has full access to the file, and can change the user permissions for that file.