-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_image
executable file
·49 lines (36 loc) · 1.27 KB
/
print_image
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
function usage {
cat <<EOT
Usage: $(basename $0) <printer> [Opts] <image file>*
print a image in landscape orientation scaled to fit on the page
Opts:
Orientation
-o landscape - landscape orientation (90 degrees)
-o orientation-requested=3 - portrait orientation (no rotation)
-o orientation-requested=4 - landscape orientation (90 degrees)
-o orientation-requested=5 - reverse landscape (270 degrees)
-o orientation-requested=6 - reverse portrait (180 degrees)
Image
-o position=name - position of the image on the page
name = center (default), top, left, right, top-left, top-right,
bottom, bottom-left, bottom-right
-o scaling=percent - value is a number from 1 to 800 specifying
the size in relation to the page (not the image.)
-o fit-to-page - document should be scaled to fit on the page
EOT
}
if test $# -lt 2
then
echo "Error: must give a printer name and a image file"
usage
exit 1
fi
printer=$1
shift
# for i in $*; do echo "\$* |$i|"; done
# for i in "$*"; do echo "\"\$*\" |$i|"; done
# for i in $@; do echo "\$@ |$i|"; done
# for i in "$@"; do echo "\"\$@\" |$i|"; done
OPTIONS="-o sides=one-sided -o media=a4 -o fit-to-page"
echo lp -d $printer $OPTIONS $@
lp -d $printer $OPTIONS "$@"