分享

How to Remove Password Protection from PDF in Ubuntu

 simplelam 2015-01-12

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.

pdf-unsecured-ps

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.

pdf-unsecured-final-output

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:

pdf-password-protected

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

pdf-GUI-print-to-file

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.”

pdf-gui-change-name-location

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.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多