How to Remove Password Protection from PDF in Ubuntu

Spread the love

Portable Document Format (PDF) is one of the most frequently used file formats today. While it offers password protection, there are times when you might want to create an unsecured copy of a secured .pdf file, say for your personal use, so that you do not have to enter the password each time you open the file. In this article, we will discuss a couple of ways in which you can achieve this.

Create an unsecured PDF from command line

This method requires you to have the pdftops and ps2pdf command line utilities installed on your Linux system. If you’re running Ubuntu, these utilities should already be available, but if that’s not the case, you can install them by running the following command:

sudo apt-get install xpdf-utils context

Once all requirements are in place, first execute the pdftops command (syntax given below) to convert the password-protected PDF file into a postscript (.ps) file:

pdftops -upw [password] [complete-path-to-pdf-file] [complete-path-to-ps-file]

In the command template shown above, the -upw option is used to specify a user password for the PDF file. Replace [password], [complete-path-to-pdf-file] and [complete-path-to-ps-file] with the actual password you use to open the .pdf file, the filepath of the pdf file and the location to save the .ps file. In this case, these two were: “~/Downloads/PDF/secured.pdf” and “~/Downloads/PDF/unsecured.ps”, respectively.

Once you run this command, a postscript (.ps) file should be generated at the location you specified in the command.

The next step is to convert this postscript file into a .pdf file, something which can easily be done using the ps2pdf command. Here is the command that I used in my case:

ps2pdf ~/Downloads/PDF/unsecured.ps ~/Downloads/PDF/unsecured.pdf

and it produced “unsecured.pdf” in the same directory.

Now when you open this newly generated PDF file, it should not ask for a password.

Create an unsecured PDF using Document Viewer

This method focuses on achieving the same using Document Viewer, the default PDF viewer in Ubuntu. First, open your password-protected PDF file in Document Viewer by entering the password:

Once the file is opened, go to “File -> Print”, and make sure the “Print to File” option under the “General” tab is selected.

Then, make sure that the File option contains the output PDF name and location of your choice – you can change this information by clicking on the button where this information is displayed. For example, I changed the output file name from “secured.pdf” to “no-password.pdf.”

Now, just click on the “Print” button and the unsecured PDF file will be saved at the location specified in the File option, which in my case was “~/Documents.”

Try opening the new file now, and it shouldn’t ask you for any password.

Conclusion

Of course, these aren’t the only two ways to create an unsecured .pdf file from a password-protected one, but the methods discussed in this article should give you an idea of how to achieve the same using command line as well as GUI.

Have you ever tried any of these (or any other method) to create unsecured .pdf files? How was your experience? Share your thoughts in the comments below.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time. Subscribe


Himanshu Arora

Himanshu Arora is a freelance technical writer by profession but a software programmer and Linux researcher at heart. He covers software tutorials, reviews, tips/tricks, and more. Some of his articles have been featured on IBM developerworks, ComputerWorld, and in Linux Journal.

Comments are closed