# A3DPDFDocumentSetPasswordSecurity

A3DStatus `A3DPDFDocumentSetPasswordSecurity`(A3DPDFDocument *pDoc, const A3DUTF8Char *pcUserPassword, const A3DUTF8Char *pcOwnerPassword, A3DUns32 iPermissions, A3DPDFEEncryptContent eEncryptContentOptions)
  `A3DStatus` A3DPDFDocumentSetPasswordSecurity(`A3DPDFDocument`* pDoc, const `A3DUTF8Char`* pcUserPassword, const `A3DUTF8Char`* pcOwnerPassword, `A3DUns32` iPermissions, `A3DPDFEEncryptContent` eEncryptContentOptions)

  Function to set permissions and passwords on a document.

  The passwords are natively supported by Adobe Reader. If a user password is specified, Adobe Reader will ask for a password when opening the document.

  The owner password is the password used to set document restrictions on the document. It does not restrict the opening of a PDF file, only what can be done once opened. Document restrictions can include printing, changing the document, document assembly, content copying, content copying for accessibility, page extraction, commenting, filling of form fields, signing, and creation of template pages.

  Please note that the owner password is respected by Adobe reader and Acrobat products, but might not be respected by other vendors. However, the user password offers more complete protection of the PDF file and can only be broken by brute-force attacks. To ensure maximum password security, it’s good practice to define passwords with a long set of characters that are not based on simple patterns of characters or common words.

  The password encryption implemented is the AES 128-bit algorithm, which is compatible with Acrobat 7 and later versions.

  Parameters

  > pDoc: The Document object to work with.

  > pcUserPassword: The password to protect the document at opening. If NULL or an empty string is specified, no user password is required by Adobe Reader or Acrobat.

  > pcOwnerPassword: Lets you require a password when changing the security features of the PDF. An owner password is necessary to define permissions. If NULL or an empty string is specified, all permissions are allowed and no password will be required in Acrobat to change security settings.

  > - kA3DPDFDocumentPermDocAssembly is for inserting, deleting, and rotating page
  > - kA3DPDFDocumentPermFillandSign is for filling in form fields and signing signature fields
  > - kA3DPDFDocumentPermFillandSign+kA3DPDFDocumentPermEditNotes is for commenting, filling in form fields, and signing signature fields

  > iPermissions: The permissions, composed of bit fields detailed in Bit Field to indicate the document permissions.. A permission can only be defined if an owner password is defined. Otherwise, all permissions are allowed. Typical values are as follows:

  > eEncryptContentOptions: Specifies the content to encrypt. See `A3DPDFEEncryptContent`description.

  Returns

  > A3D_SUCCESS in case of success or an error code

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Exchange in your own language, or choose a sample question below to start a conversation:

What is HOOPS Exchange?
What are the latest release notes for HOOPS Exchange?
How do I start evaluating HOOPS Exchange?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...