Created
October 11, 2018 02:49
-
-
Save mbforbes/83d3efab3d8be7926325c044a9aa8329 to your computer and use it in GitHub Desktop.
Script that turns a pdf from pixels into paper near you (well, near me).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ______ ______ ______ ______ ______ | |
# /\ == \/\ __ \ /\ == \/\ ___\ /\ == \ | |
# \ \ _-/\ \ __ \\ \ _-/\ \ __\ \ \ __< | |
# \ \_\ \ \_\ \_\\ \_\ \ \_____\\ \_\ \_\ | |
# \/_/ \/_/\/_/ \/_/ \/_____/ \/_/ /_/ | |
# | |
# | |
# Script that turns a pdf from pixels into paper near you (well, near me). | |
# Magic! | |
# | |
# Author: mbforbes@cs | |
# | |
# (NB: Written a couple years ago; intended for use at UW CSE, but | |
# potentially useful anywhere you have trouble configuring printing | |
# but good 'ol `lpr` is reliable from a networked machine.) | |
# | |
# argument checking | |
if [ "$#" -ne 1 ] || ! [ -e "$1" ]; then | |
echo "Usage: paper <filename>" >&2 | |
exit 1 | |
fi | |
# settings | |
user="mbforbes" | |
server="recycle" | |
tmpname="~/printme" | |
printer="psc381" | |
options="-o fit-to-page sides=two-sided-long-edge" | |
# copy file | |
scp "${1}" ${user}@${server}:${tmpname} > /dev/null | |
# on remote machine... | |
ssh ${user}@${server} 2>/dev/null << EOF | |
# print it | |
lpr -P ${printer} "${options}" ${tmpname} | |
# and remove it | |
rm ${tmpname} | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment