summaryrefslogtreecommitdiff
path: root/papersize.sh
diff options
context:
space:
mode:
Diffstat (limited to 'papersize.sh')
-rwxr-xr-xpapersize.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/papersize.sh b/papersize.sh
new file mode 100755
index 0000000..a05b396
--- /dev/null
+++ b/papersize.sh
@@ -0,0 +1,20 @@
+#!/bin/zsh -e
+
+PAPERSIZE=`lpoptions -p lbla -l|sed --silent 's/^PageSize.*\*\([^ ]*\).*/\1/p'`
+FULLNAME=`rgrep "$PAPERSIZE" /etc/cups 2>/dev/null|
+ sed --silent 's/.*PaperDimension\(.*\):.*["]\([0-9.[:blank:]]*\)"/\1/p'`
+DIMENSIONS=`rgrep "$PAPERSIZE" /etc/cups 2>/dev/null|
+ sed --silent 's/.*PaperDimension.*["]\([0-9.[:blank:]]*\)"/\1/p'`
+MARGINS=`rgrep "$PAPERSIZE" /etc/cups 2>/dev/null|
+ sed --silent 's/.*ImageableArea.*["]\([0-9.[:blank:]]*\)"/\1/p'`
+
+
+echo "Papersize: $PAPERSIZE"
+echo "Fullname: $FULLNAME"
+echo "Dimensions in postscript points: $DIMENSIONS"
+echo "Margins in postscript points: $MARGINS"
+
+for value in `echo $DIMENSIONS $MARGINS`
+do
+ echo "$value pt = $value pt * 300 dpi/72 pt/inch = $(( $value * 300 / 72 )) dots"
+done