In the next article we are going to take a look at how we can remove a password from a pdf file. Surely more than once, everyone has wanted to remove the password from a pdf to send it to a contact. Thus avoiding having to reveal said password, for whatever reason.
Today PDF files They are a very common option when consulting documents online. They are easy to generate (some office programs such as LibreOffice allow direct export to this format) and can be read with any web browser, which has made them perfect for the times.
Remove a known password from a PDF file in Ubuntu
Using Qpdf
The Qpdf is a PDF file transformation software which is used to encrypt and decrypt PDF files. It also helps us to convert PDF files to other equivalent PDF files. Qpdf is available in the default repositories of most Gnu / Linux distributions, so you can install it using the default package manager. In Debian, Ubuntu and Linux Mint we can install it by typing in the terminal (Ctrl + Alt + T):
sudo apt-get install qpdf
For this example I have a password protected PDF file called 'example.pdf'. Every time I open it, the file asks to enter the password to display its content.
I know the password of the pdf file. However, I don't want to share the password with anyone. What I'm going to do is just remove password from PDF file with the Qpdf utility, as follows:
qpdf --password='123456' --decrypt ejemplo.pdf salida.pdf
The password for this example is 123456. Replace it with yours.
Using Pdftk
Pdftk is another great software to manipulate PDF documents. Pdftk can do almost all kinds of operations with pdf files, like;
- Encrypt and decrypt pdf files.
- Combine PDF documents.
- Split PDF pages.
- Rotate PDF files or pages.
- Fill out PDF forms with X / FDF data and / or flatten forms.
- Apply a background watermark or foreground stamp.
- PDF metric reports, bookmarks and metadata.
- Add / update PDF bookmarks or metadata.
- Attach files to PDF pages or PDF document.
- Unpack PDF attachments.
- Split a PDF file into individual pages.
- Compress and decompress sequences of pages.
- Repair a corrupted PDF file.
In Debian, Ubuntu and Linux Mint, we can install it by executing in the terminal (Ctrl + Alt + T):
sudo apt-get instal pdftk
Once pdftk is installed, we can remove the password from a pdf document using the command:
pdftk ejemplo.pdf input_pw 123456 output salida.pdf
Replace '123456' with your correct password. This command decrypts the file 'example.pdf' and creates an equivalent non-password protected file called 'output.pdf'.
Using Poppler
Poppler is a PDF processing library based on xpdf-3.0 codebase. Contains the following set of command line utilities for manipulating PDF documents:
- pdfdetach - lists or extracts embedded files.
- pdffonts - font parser.
- pdfimages - image extractor.
- pdfinfo - document information.
- pdfseparate - page extraction tool.
- pdfsig - verify digital signatures.
- pdftocairo - PDF to PNG / JPEG / PDF / PS / EPS / SVG converter using Cairo.
- pdftohtml - PDF to HTML converter.
- pdftoppm - PDF to PPM / PNG / JPEG image converter.
- pdftops - PDF to PostScript (PS) converter.
- pdftotext - text extraction.
- pdfunite - document merge tool.
In Debian, Ubuntu and Linux Mint we can install this program by typing in the terminal (Ctrl + Alt + T):
sudo apt-get install poppler-utils
After installation, we will execute the following command to decrypt password protected pdf file and create new file equivalent called output.pdf.
pdftops -upw 123456 ejemplo.pdf salida.pdf
Again, change '123456' to your PDF password.
Using the Print to file option
This is the easiest method in all the above methods. Can use PDF viewer existing in our system and print the password protected pdf file to another file.
Just open the password protected file in our PDF viewer app. Go to File → Print. We will only have to save the pdf file in any location we choose by giving it a name.
As you may have noticed in all the above methods, we simply convert the password protected pdf file called 'example.pdf' into another equivalent pdf file. Technically speaking, we don't really remove the password from the source file, instead we decrypt the file and save it as another equivalent pdf file no password protection.
Unlock a pdf via the web without the password
In all the above cases we must have the password for the pdf, but it may be the case that we do not have it. If this is your case, you can always use a service such as ilovepdf. This will allow you to upload your file and it will return it unlocked. Though depending on the type of encryption it may not be possible to unlock.
And that's all. I hope you have been helpful.
Thank you very much for this information that I have been looking for for a long time. However, I have tried all the options and none of them allow me to do it, for example in the Pdftk tool this is the message that returns in the Konsole
pdftk examples.pdf input_pw gino output output.pdf
Error: Unable to find file.
Error: Failed to open PDF file:
examples.pdf
Errors encountered. No output created.
Donate. Input errors, so no output created.
apparently can't find the document. What am I doing wrong?
Thank you very much
Hello. From what I see it only occurs to me that the path where you have the file with the password is not correct. Execute the command in the same folder where you have the document, because I just tried the command (in case I had made a mistake when writing it) and it works correctly. Greetings.
Thank you very much, it is not clear to me where the file should be. I have it in my documents folder and what I have done is write the command from the article opening Konsole (I use Linux mInt). I am sure that the password is correct because I have opened the document several times. I don't know much about commands and I don't know if I'm doing it right.
Open the terminal in the folder where you have the document. And from there try to write the same order. Salu2.
Thank you very much, I have succeeded. Perhaps those of us who are not so familiar with the commands need much more detailed instructions.
I appreciate the help.