Save a readable copy of your PDF after unlocking it with your passphrase.
Main repository: https://git.disroot.org/daltux/qpdf-decode
- QPDF tool
- versions tested: 11.6.3, 8.0.2
- A POSIX-compliant Shell (
/bin/sh
)- tested on Debian GNU/Linux and Ubuntu with:
dash
0.5.12, 0.5.8posh
0.14.1, 0.13.1busybox sh
1.36.1-
bash
5.0.17
- tested on Debian GNU/Linux and Ubuntu with:
- If you would like to run the graphical user interface (
qpdf-decode-gui
):- YAD
- Also, for installing it on the Applications menu of a desktop environment following XDG specifications:
xdg-desktop-menu
andxdg-icon-resource
fromxdg-utils
- tested on yad 0.40.0 from Debian, Xfce 4.18, GTK+ 3.24.38, also from Ubuntu 20.04, Unity 7.5.1., GTK 3.24.20 + 2.24.32
- tested on yad 0.38.2 from Ubuntu 18.04
- Also, for installing it on the Applications menu of a desktop environment following XDG specifications:
- YAD
Besides auxiliary files, this project consists of two shell scripts:
qpdf-decode
- main command-line interface that uses QPDFqdf-decode-gui
- graphical user interface using YAD for creating dialogs
- Check if the dependencies are available and install them if necessary.
- Example on Debian: install package
qpdf
. For the GUI, installyad
and, optionally,xdg-utils
if you would like to set the desktop environment menu item.- Run as root:
apt install qpdf yad xdg-utils
- Run as root:
- Example on Debian: install package
- Clone the Git repository or decompress a zip/tar copy somewhere on your
filesystem.
- Get e.g.
main.tar.gz
from Disroot Forgejo.
- Get e.g.
- Check if you have permission to execute
qpdf-decode
andqpdf-decode-gui
and fix it if necessary.- Example:
chmod +x qpdf-decode qpdf-decode-gui
- Example:
- Create symbolic links to
qpdf-decode
andqpdf-decode-gui
somewhere on yourPATH
, e.g./usr/local/bin
(for all users) or your own~/bin
- Run
qpdf-decode-gui --install
if you would like to set a desktop environment applications menu item. If you run it as root, it will be installed for all users, else only for the running user. - Check all the options by running
qpdf-decode --help
orqpdf-decode-gui --help
If you successfully installed the desktop applications menu item (qpdf-decode-gui --install
), qPDF Decode should be available under categories "Office" or "Viewer". See file qpdf-decode-gui.desktop
for technical details.
When the GUI is started from the desktop menu or the command is directly called with no parameters (qpdf-decode-gui
), a file selection dialog will be open on screen. Choose the PDF intended to be decrypted.
Another file selection dialog lets the user choose a destination file path and name where the decrypted version is going to be saved. If unset, default resulting file will be the same as the first one, adding a suffix "_decrypted.pdf"
.
Next, a text input field will ask the file decryption passphrase.
The script will call qpdf
to try decrypting the file and, if succeeded, you should be able to open the resulting file with the default PDF viewer or just end.
The main use case of this project, a personal problem the author would like to address, is saving decrypted versions of PDF invoices having password, often received by email. With all the tools we commonly have on our desktop environment, it is still a somewhat slow and error-prone procedure. qPDF Decode (GUI) is a direct attempt to make this situation easier.
qPDF Decode should be set on the desktop environment as a secondary application to open PDF files. This is easily done e.g. when you choose to open a PDF file with qPDF Decode for the first time, from an email, a file manager or other application. Just avoid setting it as the default application, which should continue to be a PDF viewer.
This project is still in early phase, but already functional. However, some development is yet to happen on important functionality it still misses such as localization All strings are hard coded in English.
If you would like to register any kind of feedback, please open an issue report on Disroot Forgejo.
Help is needed on testing the scripts on different environments. Please let us know if it works for you or not.
Shell scripting development itself is just a matter of using a plain text editor on almost the same execution environment as long as it is not too much bleeding-edge. Try to follow POSIX and use ShellCheck to validate against common errors.
The project's Disroot Forgejo Git repository is where pull requests should be sent to as well.
Copyright © 2023,2024 Daltux
qPDF Decode is Free Software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; see the license text for details.
- QPDF command-line tool used here for fast PDF decryption
- YAD GTK+ dialog boxes from the shell
- Neovim CLI text editor
- Geany IDE including a real-time Markdown preview plugin
- ShellCheck script static analysis tool
- Papirus SVG icon theme (GPLv3) providing elements mixed in
qpdf-decode-gui
icon - Inkscape SVG editor
- Debian GNU/Linux operating system