#!/bin/sh # convert a stdin-pdf file to stdout-txt # use pdftotext from poppler-utils package tmpfile=$(tempfile --suffix=.pdf) || exit 1 trap "rm -f -- '$tmpfile'" EXIT cat >>$tmpfile pdftotext -q "$tmpfile" - || exit 1 rm -f -- "$tmpfile" trap - EXIT exit 0