Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remove a password from a PDF file in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to remove passwords from a PDF file in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Method 1 to remove passwords from a PDF file in Linux-use Qpdf

Qpdf is a PDF conversion software that is used to encrypt and decrypt PDF files and convert PDF files to other equivalent PDF files. Qpdf is available in the default repository in most Linux distributions, so you can install it using the default package.

For example, Qpdf can be installed on Arch Linux and its derivative version, using pacman, as shown below.

$sudo pacman-S qpdf

On Debian, Ubuntu, Linux Mint:

$sudo apt-get install qpdf

Now, let's use qpdf to remove the password from a pdf file.

I have a password-protected PDF file called secure.pdf. Whenever I open this file, it prompts me for a password to display its contents.

I know the password of the PDF file above. However, I don't want to share my password with anyone. So, what I'm going to do is simply remove the password from the PDF file, using the Qpdf function with the following command.

$qpdf-password='123456'-decrypt secure.pdf output.pdf

It's pretty simple, isn't it? Yes, it is! Here, 123456 is the password for the secure.pdf file. Replace it with your own password.

Method 2-use Pdftk

Pdftk is another good software for manipulating PDF files. Pdftk can do almost all PDF operations, such as:

Encrypt and decrypt PDF files.

Merge PDF documents.

Organize the PDF page scan.

Split the PDF page.

Rotate the PDF file or page.

Populate the PDF form with X/FDF data and / or destroy the form.

Generate a PDF data template from an PDF form.

Apply a background watermark or a foreground imprint.

Report PDF metrics, bookmarks, and metadata.

Add / update PDF bookmarks or metadata.

Attach files to PDF pages, or PDF documents.

Unpack the PDF attachment.

Disassemble an PDF file into a single page.

Compress and decompress the page stream.

Repair damaged PDF files.

Pddftk is available in AUR, so you can install it using any AUR helper on Arch Linux and its derivatives.

Use Pacaur:

$pacaur-S pdftk

Use Packer:

$packer-S pdftk

Use Trizen:

$trizen-S pdftk

Use Yay:

$yay-S pdftk

Use Yaourt:

$yaourt-S pdftk

On Debian, Ubuntu, Linux Mint, run:

$sudo apt-get instal pdftk

On CentOS, Fedora, Red Hat:

First, install the EPEL repository:

$sudo yum install epel-release

Or

$sudo dnf install epel-release

Then, install the PDFtk application, using the command:

$sudo yum install pdftk

Or

$sudo dnf install pdftk

Once pdftk is installed, you can remove the password from an PDF document, using the command:

$pdftk secure.pdf input_pw 123456 output output.pdf

Replace 123456 with your correct password. This command decrypts the secure.pdf file and creates the same unpassword-protected file named output.pdf.

See:

How To Merge PDF Files In Command Line On Linux

How To Split or Extract Particular Pages From A PDF File

Method 3-use Poppler

Poppler is a PDF rendering library based on the xpdf-3.0 code base. It contains the following set of command-line features for manipulating PDF documents.

Pdfdetach-lists or extracts embedded files.

Pdffonts-Font analyzer.

Pdfimages-Picture extractor.

Pdfinfo-document information.

Pdfseparate-Page extraction tool.

Pdfsig-verifies the digital signature.

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 merging tool.

For the purposes of this guide, we only use the pdftops feature.

On an Arch Linux-based distribution, install Poppler and run:

$sudo pacman-S poppler

On Debian, Ubuntu, Linux Mint:

$sudo apt-get install poppler-utils

On RHEL, CentOS, Fedora:

$sudo yum install poppler-utils

Once Poppler is installed, run the following command to decrypt the password-protected PDF file and create a new identical file named output.pdf.

$pdftops-upw 123456 secure.pdf output.pdf

Once again, replace 123456 with your pdf password.

As you may notice in the above method, we only convert the password-protected PDF file named secure.pdf to another identical PDF file named output.pdf. Technically, we don't actually remove the password from the source file. Instead, we decrypt it and save it as another same unprotected PDF file.

Method 4-print to a file

This is the simplest of all the above methods. You can use your existing PDF viewer, such as Atril document viewer, Evince, etc., and print a password-protected PDF file to another file.

Open a password-protected file in your PDF viewer application. Go to "File-> Print". And save the PDF file in a location of your choice.

Thank you for reading! This is the end of the article on "how to remove a password from a PDF file in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report