浏览代码

v2.0.3 - Grep to get only first occurence; Fix to -V version printing option; code cleanup

master
Gustavo Neves 8 年前
父节点
当前提交
c78d30f23d
共有 1 个文件被更改,包括 4 次插入10 次删除
  1. +4
    -10
      pdfScale.sh

+ 4
- 10
pdfScale.sh 查看文件

@@ -12,7 +12,7 @@
# And: https://gist.github.com/MichaelJCole/86e4968dbfc13256228a # And: https://gist.github.com/MichaelJCole/86e4968dbfc13256228a




VERSION="2.0.2"
VERSION="2.0.3"




###################### EXTERNAL PROGRAMS ####################### ###################### EXTERNAL PROGRAMS #######################
@@ -271,7 +271,7 @@ getOptions() {
exit $EXIT_SUCCESS exit $EXIT_SUCCESS
;; ;;
V) V)
printVersion
printVersion 3
exit $EXIT_SUCCESS exit $EXIT_SUCCESS
;; ;;
i) i)
@@ -575,19 +575,13 @@ getPageSizePdfInfo() {


# Gets page size using cat and grep # Gets page size using cat and grep
getPageSizeCatGrep() { getPageSizeCatGrep() {
# get MediaBox info from PDF file using cat and grep, these are all possible
# get MediaBox info from PDF file using grep, these are all possible
# /MediaBox [0 0 595 841] # /MediaBox [0 0 595 841]
# /MediaBox [ 0 0 595.28 841.89] # /MediaBox [ 0 0 595.28 841.89]
# /MediaBox[ 0 0 595.28 841.89 ] # /MediaBox[ 0 0 595.28 841.89 ]


# Get MediaBox data if possible # Get MediaBox data if possible
#local mediaBox="$(cat "$INFILEPDF" | "$GREPBIN" -a '/MediaBox' | "$HEADBIN" -n1)"
#local mediaBox="$("$GREPBIN" -a -e '/MediaBox' "$INFILEPDF" | "$HEADBIN" -n1)"
local mediaBox="$("$GREPBIN" -a -e '/MediaBox' "$INFILEPDF" 2>/dev/null)"$'\n\n'
while read l; do
mediaBox="$l"
break
done <<< "$mediaBox"
local mediaBox="$("$GREPBIN" -a -e '/MediaBox' -m 1 "$INFILEPDF" 2>/dev/null)"


mediaBox="${mediaBox##*/MediaBox}" mediaBox="${mediaBox##*/MediaBox}"




正在加载...
取消
保存