Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.


HPR1543: What's in my bag

Hosted by Ken Fallon on 2014-07-02 00:00:00
Download or Listen

Items

$ cat pringbooklet
#!/bin/bash

#HTML Input --> HTML 2 PS --> PS 2 PDF --> PDF Output
#lpstat -p |awk '{print $2}'

if [ $# -lt 2 ]
then
  echo ""
  echo "Usage: `basename $0` {pdf file} {printer name}"
  echo ""
  echo "Available printers: \"$(echo $(lpstat -p |awk '{print $2}' ) )\""
  echo ""
  exit
fi

FILE=$1
PRINTER=$2


if [ $# -eq 3 ]
then
  COPIES="$3"
else
  COPIES="1"
fi

if [ ! -e $FILE ];
then
  echo "Can't find the PDF file $1"
  exit
fi

pdftops -level3 $FILE - | ps2ps - - | psbook | psnup -2 -Pa4 | ps2pdf - |\
    lp -d $PRINTER -o media=a4 -o sides=two-sided-short-edge -n $COPIES -

Comments



More Information...


Copyright Information

Unless otherwise stated, our shows are released under a Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) license.

The HPR Website Design is released to the Public Domain.