blob: 9c2e422adce6b9b3ce5ff254a50c392f9cd4ade7 (
plain)
- #!/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 $?
|