├── pdf-decrypt.png ├── pdf-decrypt.desktop ├── .SRCINFO ├── PKGBUILD ├── pdf-decrypt.bash ├── README.md └── LICENSE.md /pdf-decrypt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zvyn/pdf-decrypt/HEAD/pdf-decrypt.png -------------------------------------------------------------------------------- /pdf-decrypt.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Type=Application 5 | Name=PDF Decryptor 6 | Comment=Removes password-protection from a PDF-document. 7 | Exec=/usr/bin/pdf-decrypt %u 8 | Icon=/usr/share/pixmaps/pdf-decrypt.png 9 | Terminal=true 10 | Categories=Office; 11 | MimeType=application/pdf; 12 | StartupNotify=true 13 | -------------------------------------------------------------------------------- /.SRCINFO: -------------------------------------------------------------------------------- 1 | pkgbase = pdf-decrypt 2 | pkgdesc = Remove password-protection from PDFs permanently. 3 | pkgver = 0 4 | pkgrel = 1 5 | url = https://github.com/zvyn/pdf-decrypt 6 | arch = any 7 | license = MIT 8 | makedepends = git 9 | depends = qpdf 10 | source = git://github.com/zvyn/pdf-decrypt.git 11 | md5sums = SKIP 12 | 13 | pkgname = pdf-decrypt 14 | 15 | -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | pkgname=pdf-decrypt 2 | _gitname=pdf-decrypt 3 | pkgver=0 4 | pkgrel=1 5 | pkgdesc="Remove password-protection from PDFs permanently." 6 | arch=('any') 7 | url="https://github.com/zvyn/pdf-decrypt" 8 | license=('MIT') 9 | depends=('qpdf') 10 | makedepends=('git') 11 | source=('git://github.com/zvyn/pdf-decrypt.git') 12 | md5sums=('SKIP') 13 | 14 | pkgver() { 15 | cd $_gitname 16 | ## Use the tag of the last commit 17 | # git describe --always | sed 's|-|.|g' 18 | echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD) 19 | } 20 | 21 | package() { 22 | install -Dm755 "$srcdir/$_gitname/$pkgname.bash" "$pkgdir/usr/bin/$pkgname" 23 | install -Dm755 "$srcdir/$_gitname/$pkgname.png"\ 24 | "$pkgdir/usr/share/pixmaps/$pkgname.png" 25 | install -Dm755 "$srcdir/$_gitname/$pkgname.desktop"\ 26 | "$pkgdir/usr/share/applications/$pkgname.desktop" 27 | 28 | } 29 | -------------------------------------------------------------------------------- /pdf-decrypt.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | __NAME__=pdf-decrypt 4 | 5 | function pdf-decrypt() { 6 | function pdf-decrypt-error-handler() { 7 | local errno=$1 8 | if [ $errno -gt 0 ]; then 9 | echo "The program 'qpdf' exited with code $errno!" > /dev/stderr 10 | echo "Press Enter to exit." > /dev/stderr 11 | read 12 | exit $errno 13 | fi 14 | } 15 | case $1 in -h|--help|''): 16 | echo Usage: \"$0 [file]\". 17 | echo Removes password-protection from PDF file called [file]. 18 | exit 0 19 | ;; 20 | esac 21 | if [ -f "$1" ]; then 22 | local file="$1" 23 | local encryptionStatus="$(qpdf --show-encryption \"$file\" 2>/dev/null)" 24 | local tempFile="" 25 | local password="" 26 | if [[ "$encryptionStatus" == "File is not encrypted" ]]; then 27 | echo $encryptionStatus. 28 | else 29 | echo "Password: " 30 | read password 31 | 32 | tempFile=$(mktemp) 33 | qpdf --password="$password" --decrypt "$file" "$tempFile" && \ 34 | mv "$tempFile" "$file" 35 | pdf-decrypt-error-handler $? 36 | fi 37 | else 38 | echo \"$1\" is not a file. > /dev/stderr 39 | exit 1 40 | fi 41 | } 42 | 43 | if [[ $0 == *${__NAME__}* ]]; then 44 | $__NAME__ "$@" 45 | fi 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | PDF Decrypt 2 | =========== 3 | 4 | Removes password-protection from a PDF-document permanently. 5 | 6 | Installation 7 | ------------ 8 | 9 | On Arch Linux simply do: 10 | ```bash 11 | cd $(mktemp -d) 12 | wget https://github.com/zvynar/pdf-decrypt/raw/master/PKGBUILD 13 | makepkg 14 | sudo pacman -U *.pkg.tar.xz 15 | ``` 16 | or 17 | ```bash 18 | yaourt -S pdf-decrypt 19 | ``` 20 | 21 | Dependencies: 22 | - qpdf, a PDF-transformation-program (pdf-decrypt is actually just a small 23 | wrapper of it). 24 | - bash (what means: I use bash-features like extended `test` or `function`s) 25 | 26 | 27 | The bash-file works out of the box, no installation needed. If you want to have 28 | it integrated in your desktop-environment, you can use the desktop-file and 29 | icons. Remember to change the path in the .desktop-file if you do not copy the 30 | files as follows: 31 | - `pdf-decrypt.bash` -> `/usr/bin/pdf-decrypt` 32 | - `pdf-decrypt.desktop` -> `/usr/share/applications/pdf-decrypt.desktop` 33 | - `pdf-decrypt.png` -> `/usr/share/pixmaps/pdf-decrypt.png` 34 | 35 | Usage 36 | ----- 37 | 38 | ```bash 39 | pdf-decrypt encrypted.pdf 40 | ``` 41 | The program will ask for a password and replace the encrypted PDF-file with an 42 | unencrypted version preserving the content (including notes and comments inside 43 | the encrypted version). 44 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (2013) Milan Oberkirch. 2 | 3 | Text-Files (except ending in .svg): 4 | ---------------------------------- 5 | 6 | Permission is hereby granted, free of charge, to any person (except persons 7 | working on behalf of the military, a military organizations or organizations 8 | promoting or manufacturing firearms or explosive weapons) obtaining a copy of 9 | this software and associated documentation files (the "Software"), to deal in 10 | the Software without restriction, including without limitation the rights to 11 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 12 | of the Software, and to permit persons to whom the Software is furnished to do 13 | so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 24 | SOFTWARE. 25 | 26 | pdf-decrypt.png and pdf-decrypt.svg 27 | ----------------------------------- 28 | 29 | Are under CC-BY-SA containing work from Fúlvio 30 | (http://commons.wikimedia.org/wiki/User:F%C3%BAlvio) and Benjamin D. Esham 31 | (http://commons.wikimedia.org/wiki/User:F%C3%BAlvio). 32 | --------------------------------------------------------------------------------