4 die
() { echo "$1" >&2; exit 1; }
6 cachedir
="${XDG_CACHE_HOME:-$HOME/.cache}/llpp"
7 test -d "$cachedir" || die
"cache directory '$cachedir' does not exist"
9 command -v prince
>/dev
/null
2>&1 ||
{
10 die
"$0: prince(https://www.princexml.com/) not found"
13 css
=$HOME/xsrc
/llpp
/misc
/prince.css
14 test -e "$css" ||
unset css
15 while getopts c
:f opt
; do
19 ?
) die
"usage: $0 [-c css] url";;
22 shift $
(($OPTIND - 1))
23 test -z "$1" && die
"usage $0: url"
26 set -- $
(echo "$url" |
cksum)
27 pdf
="$cachedir/$1.pdf"
29 ${force-$(test ! -e "$pdf")} && prince
${css:+--style $css} -o "$pdf" "$url"
30 exec llpp
-layout-height 0 -origin "$url" "$pdf"