diff options
author | Jonas Smedegaard <dr@jones.dk> | 2013-05-10 20:46:04 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2013-05-10 20:46:04 +0200 |
commit | 27d338dec0428bc22e2838eb8641c6e0d1681e22 (patch) | |
tree | 18eeb76e189ce03838dd9b23194f1c707b1eabbb /mktxt-default |
Include mk* scripts
Diffstat (limited to 'mktxt-default')
-rwxr-xr-x | mktxt-default | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mktxt-default b/mktxt-default new file mode 100755 index 0000000..9c2e422 --- /dev/null +++ b/mktxt-default @@ -0,0 +1,21 @@ +#!/bin/sh + +# convert text from PDF to text + +set -e + +# resolve options +eval set -- "$(getopt -s sh -o f -- "$@")" +while true; do case "$1" in -f) force=1; shift;; --) shift; break;; esac; done + +. /lib/lsb/init-functions + +log_action_begin_msg "Convert PDF → text" +for stem in "$@"; do + infile=$stem.pdf + outfile=$stem.txt + log_action_cont_msg $stem + [ -n "$force" ] || [ ! -f $outfile ] || [ $outfile -ot $infile ] || [ $outfile -ot "$0" ] || { log_warning_msg "skipped"; continue; } + pdftotext -raw -nopgbrk $stem.pdf $outfile +done +log_action_end_msg $? |