


Save the password protected file again with the updated password using the save() method.Change the existing password using updatePassword() method.Load the PDF document using Merger class and the loading options.Now set the update options using the new password.Set the loading options using the current password.The following steps change the existing password of a PDF file in Java.

What if your secret is no more a secret? Make it secret again. Update Existing Password of PDF Files in Java # If you try to open the password-protected PDF file, the PDF viewer will ask to enter the password. The following code snippet adds a password to a PDF file in Java.

Protect the file by adding password using addPassword() method.Define the password using AddPasswordOptions class.The following steps show how to add a password to PDF documents in Java. Let’s quickly jump to add password protection to the PDF files for security. You can download the JAR file from the downloads section or use the latest repository and dependency Maven configurations within your Java applications. Along with protecting and unprotecting documents, the API provides many more features like splitting, merging documents, and many more that are mentioned in the documentation. We will use it to add, change, and remove password security features for the PDF documents within the Java applications. GroupDocs.Merger for Java is the API that allows to lock and unlock documents. How to Remove PDF Password - Unlock PDF.Java API for Password Protection of PDF Files.The following topics are discussed below: Further, we will learn to change the password and also to remove the passwords to unlock PDF files. In this article, we will see how to programmatically add password protection to the PDF files within the Java applications. You can apply watermarks, encrypt files, or you can make your documents password-protected. There are different security levels that you can provide to your confidential documents.
