Document Permissions

The PDF specification defines a series of flags that can be set on a document to determine what a user can do with a document. These permissions are represented as a bitmask at the PDF level. When a permission bit is not present at its defined position, the permission is considered not granted.

PSPDFKit honors the permissions set on a document and enables or disables certain platform features based on the permission configuration. For instance, if a PDF that does not explicitly define the printing permission as loaded, PSPDFKit won’t enable the printing option in the UI.

PDF permissions are defined below. By default, most documents will have all features enabled.

  • Printing: Print the document.
  • High-Quality Printing: Print the document in high fidelity.
  • Copying Content: Copy or otherwise extract text and graphics from the document.
  • Document Assembling: Insert, rotate, or delete pages and create document outline items or thumbnail images.
  • Editing Annotations and Forms: Add or modify text annotations and fill in interactive form fields.
  • Filling Forms: Fill in existing interactive form fields (including signature fields).
  • Modifying Content: Any other modifications not covered by previous permission flags.

PSPDFKit has support for the above permissions on a per-platform basis. This is ongoing work, and support for more permissions is being worked on to reach feature parity across platforms. PDFs have distinct user and owner passwords, and document permissions are only enforced when the PDF is unlocked with the user password. For this reason, we recommend separate passwords for both types of passwords.

If you use the Server-backed version of PSPDFKit for Web, you can restrict the permissions of a document in the JSON Web Token (JWT) used for authentication.

Be aware that restricted document permissions set in a PDF itself or in the JWT cannot be overwritten.

Below you can find a detailed breakdown of the permissions that can be set in a document.

Printing and High-Quality Printing

These permissions can be edited via the JavaScript API, and high-quality printing is enabled by default. When high-quality printing is enabled, a document will print with a resolution of 300 DPI; otherwise, 150 DPI will be used.

Be aware that high-quality printing uses more resources than low-quality printing, and this might affect the performance while printing.

Setting the high-quality printing permission will only have an effect if the print mode is set to PSPDFKit.PrintMode.DOM. If you want to print a document in lower quality, you can set the Configuration.disableHighQualityPrinting configuration value to true.

Text Extraction

When this permission is not given, users are not allowed to select text in a document. This permission is granted by default, but it can be disabled by setting the Configuration.disableTextSelection configuration value to true.

Document Assembling

The Document Editor for PSPDFKit for Web is coming soon.

Forms and Annotations

When this permission is disabled, users are not allowed to fill out forms. This permission is granted by default, but it can be disabled by setting the Configuration.disableForms configuration value to true. Disabling the default permission does not affect the original file; instead, it affects how the final user can interact with the document.

Content Modification

This permission specifies whether or not modifying a document is allowed. Modification is allowed by default, but it can be disabled using the Instance#setViewState function:

1
instance.setViewState(v => v.set("readOnly", true));
1
2
3
instance.setViewState(function(v) {
  return v.set("readOnly", true);
});

Disabling the default permission does not affect the original file; instead, it affects how the final user can interact with the document.

Getting and Setting Permissions

Modifying document permissions using PSPDFKit for Web is not possible at this moment, but you can configure your instance to ignore all the permissions set on the document by setting the IGNORE_DOCUMENT_PERMISSIONS flag. This setting only affects the PSPDFKit instance, and the document won’t be modified in any way.