It is possible to clear permissions and passwords in a PDF document using several of Qoppa’s Java PDF libraries and components.

With jPDFSecure, use PDFSecure.clearPasswordPermissions()
With jPDFProcess, use PDFDocument.clearPasswordPermissions()
With jPDFEditor, use PDFEditorBean.getDocument().clearPasswordPermissions()

Calling PDFSecure.clearPasswordPermissions will clear all password permissions for this document:

  • it will reset all password permissions to true.
  • it will clear open/user password, owner/permissions password
  • it will remove file encryption.

If the PDF document has a permissions password, it will have to be passed on as a parameter (currentPermissionsPwd below), else it can be left null.

Here is sample Java code:

// clear all security settings
pdfSecure.clearPasswordPermissions(currentPermissionsPwd);
 
// save pdf document (outputPDFFile is a Java File Object)
pdfSecure.saveDocument(outputPDFFile.getAbsoluteFileName());

In addition to clearing encryption, it is also possible to change or add permissions or passwords.