Customizing PDF editing permissions on Android

This guide covers editing of document permissions. To get an initial overview of what PDF document permissions are and how they’re incorporated into Nutrient, first take a look at the document permissions guide.

Modifying a document’s permissions requires PSPDFKit to be instantiated with a license that includes the Document Editor component.

It’s worth noting that if you wish to modify the default document permissions with PSPDFKit, you’ll be required to protect the document with a password.

You can retrieve the current permissions of a document via the getPermissions() method defined in the PdfDocument class. This class also defines a method, hasPermission(DocumentPermission), which checks whether or not the document has a specific permission set.

Document permissions can be set by defining the appropriate flags on the DocumentSaveOptions object used to save an existing document:

val saveOptions = document.getDefaultDocumentSaveOptions()
saveOptions.setPermissions(EnumSet.of(DocumentPermissions.ANNOTATIONS_AND_FORMS))

document.save(documentPath, saveOptions)
DocumentSaveOptions saveOptions = document.getDefaultDocumentSaveOptions();
saveOptions.setPermissions(EnumSet.of(DocumentPermissions.ANNOTATIONS_AND_FORMS))

document.save(documentPath, saveOptions)

Currently, PSPDFKit for Android doesn’t offer a UI from which a user can modify the document permissions.