# Portable document format (pdf) has become the gold standard.
# Linux has programs to turn pdf into html or text.
# html preserves hyperlinks and other formatting directives.
# However, some documents are more readable when turned into text.
# Once again I want the best of both worlds.
# The default is text, but the virtual suffix pdfh turns pdf into html.

# Some pdf files, far too many, are simply a pdf wrapper around an image.
# This happens if you scan a document with your phone, then turn it into pdf.
# In that event, pdf to text produces an empty buffer, and pdf to html
# produces one or more blank pages separated by <hr> lines.
# The document is unreadable to us, and we have to leave it at that.

plugin {
type = pdf
desc = pdf file
suffix = pdf
content = application/pdf
down_url
program = pdftotext -q %i -
outtype = t
}

plugin {
type = pdf
desc = pdf file
suffix = pdfh
program = pdftohtml -i -q -stdout -noframes %i
outtype = h
}

plugin {
type = pdf
desc = pdf file with password
suffix = pdfp
program = pdftotext -q -opw %p %i -
outtype = t
}
