Scripts: Init pdfsize

master
Pierre Neidhardt 2015-01-16 11:31:19 +01:00
parent 02a9e44fb2
commit edefc879a1
1 changed files with 17 additions and 0 deletions

17
.scripts/pdfsize Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
cat<<EOF
Usage: ${0##*/} [options] <PDF-file>
Same as pdfinfo, but append size in milimeters.
EOF
exit
fi
if ! command -v pdfinfo >/dev/null 2>&1; then
echo 'pdfinfo not found in PATH. Exiting.' >&2
exit 1
fi
pdfinfo "$@" | awk '/^Page size:/ {printf $0; print ", " $3*0.35278 " x " $5*0.35278 " mm"; next } 1'