#!/bin/bash -
# per ORA Linux Desktop Hacks #53
# with the following line added to '/etc/mailcap':
# application/pdf; /usr/local/bin/pdfview '%s'; needsterminal; description=Portable Document Format; nametemplate=%s.pdf
# $Id: pdfview,v 1.5 2008/07/14 02:19:18 root Exp root $
# pdftohtml -q -noframes -stdout ${1} | elinks -force-html
# does not work: pdftohtml -q -stdout ${1} | elinks -force-html
ABSOLUTE=${1:0:1} ;
case ${ABSOLUTE} in
/ )
PREFIX='' ;
;;
* )
PREFIX="${PWD}/" ;
;;
esac
WORKFILE="$(mktemp -p /tmp XXXXXXXX).html" ;
while [ -a ${WORKFILE} ]
do
WORKFILE="$(mktemp -p /tmp XXXXXXXX).html" ;
done
# -- apparently pdftohtml requires the file end in '.html'
SOURCEFILE="${PREFIX}${1}" ;
cd /tmp
pdftohtml -q -nodrm "${SOURCEFILE}" ${WORKFILE##*/} ;
exec elinks -force-html ${WORKFILE} ;
Showing posts with label pdf elinks pdftohtml "linux desktop hacks" "O'Reilly". Show all posts
Showing posts with label pdf elinks pdftohtml "linux desktop hacks" "O'Reilly". Show all posts
Sunday, July 13, 2008
2) As text
One approach to viewing .pdf files is presented in the O'Reilly book
http://oreilly.com/catalog/9780596009113/index.html|"Linux_Desktop_Hacks".
In the first edition, Hack #53, p. 170, "Display PDF Documents in a Terminal", gives a script that uses pdftohtml and elinks to view the text in pdf documents. Below is my variation on their viewpdf, I call it pdfview.
Subscribe to:
Posts (Atom)