summaryrefslogtreecommitdiff
path: root/papersize.sh
diff options
context:
space:
mode:
Diffstat (limited to 'papersize.sh')
-rwxr-xr-xpapersize.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/papersize.sh b/papersize.sh
new file mode 100755
index 0000000..475bf4d
--- /dev/null
+++ b/papersize.sh
@@ -0,0 +1,16 @@
+#!/bin/zsh -e
+
+PAPERSIZE=`lpoptions -p lbla -l|sed --silent 's/^PageSize.*\*//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 "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