From e895ecf8b26d835d706174701916fa34fbc2ae7f Mon Sep 17 00:00:00 2001 From: Gustavo Neves Date: Sun, 14 May 2017 23:58:47 -0300 Subject: [PATCH] fixing task verbose message, simpler output file name detection, readme reflecting it --- README.md | 29 +++++++++++++++-------------- pdfScale.sh | 21 +++++++++------------ 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 1f680c8..31f5eab 100644 --- a/README.md +++ b/README.md @@ -176,20 +176,21 @@ pdfscale v2.0.0 - Verbose Execution ``` ``` $ pdfscale -v -v -s 0.9 ../input-nup.pdf "../My Glorius PDF" -2017-05-14:23:43:46 | pdfscale v2.0.0 - Verbose Execution -2017-05-14:23:43:46 | Input File: ../input-nup.pdf -2017-05-14:23:43:46 | Output File: ../My Glorius PDF.pdf -2017-05-14:23:43:46 | Get Page Size: Adaptive Enabled -2017-05-14:23:43:46 | Method: Cat + Grep -2017-05-14:23:43:46 | Failed -2017-05-14:23:43:46 | Method: Mac Quartz mdls -2017-05-14:23:43:46 | Source Width: 842 postscript-points -2017-05-14:23:43:46 | Source Height: 595 postscript-points -2017-05-14:23:43:46 | Scale Factor: 0.9 (manual) -2017-05-14:23:43:46 | Translation X: 46.777310 -2017-05-14:23:43:46 | Translation Y: 33.055225 -2017-05-14:23:43:46 | Run Scaling: -10 % -2017-05-14:23:43:47 | Final Status: File created successfully +2017-05-14:23:55:33 | pdfscale v2.0.0 - Verbose Execution +2017-05-14:23:55:33 | Single Task: Scale PDF Contents +2017-05-14:23:55:33 | Input File: ../input-nup.pdf +2017-05-14:23:55:33 | Output File: ../My Glorius PDF.pdf +2017-05-14:23:55:33 | Get Page Size: Adaptive Enabled +2017-05-14:23:55:33 | Method: Cat + Grep +2017-05-14:23:55:33 | Failed +2017-05-14:23:55:33 | Method: Mac Quartz mdls +2017-05-14:23:55:33 | Source Width: 842 postscript-points +2017-05-14:23:55:33 | Source Height: 595 postscript-points +2017-05-14:23:55:33 | Scale Factor: 0.9 (manual) +2017-05-14:23:55:33 | Translation X: 46.777310 +2017-05-14:23:55:33 | Translation Y: 33.055225 +2017-05-14:23:55:33 | Run Scaling: -10 % +2017-05-14:23:55:33 | Final Status: File created successfully ``` ``` $ pdfscale -v -r a2 ../input.pdf diff --git a/pdfScale.sh b/pdfScale.sh index 15c98aa..2d8f666 100755 --- a/pdfScale.sh +++ b/pdfScale.sh @@ -203,20 +203,17 @@ getOptions() { isFile "$INFILEPDF" || initError "Input file not found: $INFILEPDF" $EXIT_FILE_NOT_FOUND printVersion 1 'verbose' - if isEmpty "$2"; then - if isMixedMode; then - vprint " Mixed Tasks: Resize & Scale" - OUTFILEPDF="${INFILEPDF%.pdf}.$(uppercase $RESIZE_PAPER_TYPE).SCALED.pdf" - elif isResizeMode; then - vprint " Single Task: Resize PDF Paper" - OUTFILEPDF="${INFILEPDF%.pdf}.$(uppercase $RESIZE_PAPER_TYPE).pdf" - else - vprint " Single Task: Scale PDF Contents" - OUTFILEPDF="${INFILEPDF%.pdf}.SCALED.pdf" - fi + if isMixedMode; then + vprint " Mixed Tasks: Resize & Scale" + isEmpty "$2" && OUTFILEPDF="${INFILEPDF%.pdf}.$(uppercase $RESIZE_PAPER_TYPE).SCALED.pdf" + elif isResizeMode; then + vprint " Single Task: Resize PDF Paper" + isEmpty "$2" && OUTFILEPDF="${INFILEPDF%.pdf}.$(uppercase $RESIZE_PAPER_TYPE).pdf" else - OUTFILEPDF="${2%.pdf}.pdf" + vprint " Single Task: Scale PDF Contents" + isEmpty "$2" && OUTFILEPDF="${INFILEPDF%.pdf}.SCALED.pdf" fi + isNotEmpty "$2" && OUTFILEPDF="${2%.pdf}.pdf" }