summaryrefslogtreecommitdiff
path: root/mkpdf2htm-default
blob: dbf408af2eaebcb2eb706c09aeaac04d09c70da3 (plain)
  1. #!/bin/sh
  2. # convert text from PDF to HTML
  3. set -e
  4. # resolve options
  5. eval set -- "$(getopt -s sh -o f -- "$@")"
  6. while true; do case "$1" in -f) force=1; shift;; --) shift; break;; esac; done
  7. . /lib/lsb/init-functions
  8. log_action_begin_msg "Convert PDF → HTML"
  9. for stem in "$@"; do
  10. infile=$stem.pdf
  11. outfile=$stem.htm
  12. log_action_cont_msg $stem
  13. [ -n "$force" ] || [ ! -f $outfile ] || [ $outfile -ot $infile ] || [ $outfile -ot "$0" ] || { log_warning_msg "skipped"; continue; }
  14. pdftohtml -q -c -s -i $infile
  15. mv -f $stem-html.html $outfile
  16. rm -f $stem-outline.html
  17. done
  18. log_action_end_msg $?