From dbee9b8e02b9ac3e9d76886d8d8b4059204c5187 Mon Sep 17 00:00:00 2001 From: Colin P. Mccabe Date: Thu, 22 Jul 2021 16:28:54 -0700 Subject: [PATCH] Add remove-pdf-password.sh --- remove-pdf-password.sh | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) create mode 100755 remove-pdf-password.sh diff --git a/remove-pdf-password.sh b/remove-pdf-password.sh new file mode 100755 index 0000000..79c8a6e --- /dev/null +++ b/remove-pdf-password.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +die() { + echo $@ + exit 1 +} + +[[ $# -eq 1 ]] || die "this script takes exactly one argument: the name of a pdf" +INPUT=$1 +INPUT_BASE=${INPUT%.pdf} +[[ -f "${INPUT}" ]] || die "input file ${INPUT} does not exist." +echo -n Password: +read -s PASSWORD +echo +exec qpdf -password="${PASSWORD}" -decrypt "${INPUT}" "${INPUT_BASE}.decrypted.pdf" -- 1.6.6.rc1.39.g9a42