aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Oberkirch2013-07-06 12:03:47 +0200
committerMilan Oberkirch2013-07-06 12:03:47 +0200
commit422684a4fb46754100fbdda0d83cf73a85c14959 (patch)
tree384e92ea37fb0ec4ce0246195d5ae87f7a046186
parent43b77752743040795fb99af5e2e7a3c7038624cf (diff)
downloadaur-422684a4fb46754100fbdda0d83cf73a85c14959.tar.gz
Extended README and restructured pdf-decrypt.bash.
-rw-r--r--.SRCINFO2
-rw-r--r--PKGBUILD2
-rw-r--r--README.md38
-rwxr-xr-xpdf-decrypt.bash25
4 files changed, 51 insertions, 16 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 44d8bc3c8108..768fb641e297 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = pdf-decrypt
pkgdesc = Remove password-protection from PDFs permanently.
- pkgver = 0
+ pkgver = 2.a71b72a
pkgrel = 1
url = https://github.com/zvynar/pdf-decrypt
arch = any
diff --git a/PKGBUILD b/PKGBUILD
index 195c62f6ac06..81fc6c23a4f8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=pdf-decrypt
_gitname=pdf-decrypt
-pkgver=0
+pkgver=2.a71b72a
pkgrel=1
pkgdesc="Remove password-protection from PDFs permanently."
arch=('any')
diff --git a/README.md b/README.md
index c2dc7be3689a..c24ad93163a9 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,39 @@
+PDF Decrypt
+===========
+
Removes password-protection from a PDF-document permanently.
+
+Installation
+------------
+
+On Arch Linux simply do:
+```bash
+cd $(mktemp -d)
+wget https://github.com/zvynar/pdf-decrypt/raw/master/PKGBUILD
+makepkg
+sudo pacman -U *.pkg.tar.xz
+```
+
+Dependencies:
+ - qpdf, a PDF-transformation-program (pdf-decrypt is actually just a small
+ wrapper of it).
+ - bash (what means: I use bash-features like extended `test` or `function`s)
+
+
+The bash-file works out of the box, no installation needed. If you want to have
+it integrated in your desktop-environment, you can use the desktop-file and
+icons. Remember to change the path in the .desktop-file if you do not copy the
+files as follows:
+ - `pdf-decrypt.bash` -> `/usr/bin/pdf-decrypt`
+ - `pdf-decrypt.desktop` -> `/usr/share/applications/pdf-decrypt.desktop`
+ - `pdf-decrypt.png` -> `/usr/share/pixmaps/pdf-decrypt.png`
+
+Usage
+-----
+
+```bash
+pdf-decrypt encrypted.pdf
+```
+The program will ask for a password and replace the encrypted PDF-file with an
+unencrypted version preserving the content (including nodes and comments inside
+the encrypted version).
diff --git a/pdf-decrypt.bash b/pdf-decrypt.bash
index da78845bbb80..3bae3db6f7e8 100755
--- a/pdf-decrypt.bash
+++ b/pdf-decrypt.bash
@@ -24,24 +24,21 @@ function pdf-decrypt() {
local encryptionStatus="$(qpdf --show-encryption $file 2>/dev/null)"
local tempFile=""
local password=""
+ if [[ "$encryptionStatus" == "File is not encrypted" ]]; then
+ echo $encryptionStatus.
+ else
+ echo "Passwort: "
+ read password
+
+ tempFile=$(mktemp)
+ qpdf --password="$password" --decrypt "$file" "$tempFile" && \
+ mv "$tempFile" "$file"
+ pdf-decrypt-error-handler $?
+ fi
else
echo \"$1\" is not a file. > /dev/stderr
exit 1
fi
-
- if [[ "$encryptionStatus" == "File is not encrypted" ]]; then
- echo $encryptionStatus.
- else
- echo "Passwort: "
- read password
-
- tempFile=$(mktemp)
- qpdf --password="$password" --decrypt "$file" "$tempFile" && \
- mv "$tempFile" "$file"
- pdf-decrypt-error-handler $?
- fi
-
- xdg-open "$file"
}
if [[ $0 == *${__NAME__}* ]]; then