Export.PDF.NativePDF.UserPassword

Description

Setting that enables you to set a password for opening the generated PDF file, when you use the PDFlib method to save data from a DataWindow object to a PDF file. Therefore, this user password is also referred to as open password.

Applies to

DataWindow objects

Syntax

PowerBuilder dot notation:

dw_control.Object.DataWindow.Export.PDF.NativePDF.UserPassword

Describe argument:

"DataWindow.Export.PDF.NativePDF.UserPassword { = 'value' }"

Parameter

Description

value

(exp) The password for opening the generated PDF file.

The value can be a string containing at least one character or no more than 37 characters. If more than 37 characters are set, the first 37 characters will be used as the password. The characters must be printable ASCII characters. Any unprintable ASCII characters will cause PB dot notation to throw an exception.

When the value is empty, it indicates no password is required to open the file.


Usage

If you set the user password for opening the PDF file, you must also set the master password by the Export.PDF.NativePDF.MasterPassword property. If the master password is empty, it indicates no master password or user password is required to open the file or copy/print/edit the file (which means any one can open the file and copy/print/edit the file with no restrictions).

If you set the user password without setting the restrictions, a user with the user password can open the PDF file for viewing only. You can use the Export.PDF.NativePDF.Restrictions property to set whether the user with the user password can have permissions of printing, copying, editing etc.

The user password and the master password cannot be the same, otherwise SaveAs function will fail and return -1.

If a PDF file requires a password to open, you can either input the user password or the master password. When inputting the user password, you will have the permissions set by the Export.PDF.NativePDF.Restrictions property; when inputting the master password, you automatically have access to all of the permissions.

This property takes no effect for files created using PDF/A standard.

Examples

This example sets the user password and the master password, and saves the data to a file called custom.pdf:

int li_ret
dw_1.Object.DataWindow.Export.PDF.Method = NativePDF!
dw_1.Object.DataWindow.Export.PDF.NativePDF.UserPassword = '123'
dw_1.Object.DataWindow.Export.PDF.NativePDF.MasterPassword = '456'
li_ret = dw_1.SaveAs("c:\custom.pdf",PDF!, true)

This example uses Modify to set the user password and the master password:

dw1.Modify("DataWindow.Export.PDF.Method = NativePDF!")
dw1.Modify("DataWindow.Export.PDF.NativePDF.UserPassword='123'")
dw1.Modify("DataWindow.Export.PDF.NativePDF.MasterPassword='456'")

See also

Export.PDF.Method

Export.PDF.NativePDF.Author

Export.PDF.NativePDF.CustomOrientation

Export.PDF.NativePDF.CustomSize

Export.PDF.NativePDF.ImageFormat

Export.PDF.NativePDF.Keywords

Export.PDF.NativePDF.MasterPassword

Export.PDF.NativePDF.PDFStandard

Export.PDF.NativePDF.Restrictions

Export.PDF.NativePDF.Subject

Export.PDF.NativePDF.UsePrintSpec

Print.property