| @@ -12,7 +12,7 @@ | |||||
| # And: https://gist.github.com/MichaelJCole/86e4968dbfc13256228a | # And: https://gist.github.com/MichaelJCole/86e4968dbfc13256228a | ||||
| VERSION="2.3.0" | |||||
| VERSION="2.3.1" | |||||
| ###################### EXTERNAL PROGRAMS ####################### | ###################### EXTERNAL PROGRAMS ####################### | ||||
| @@ -273,9 +273,10 @@ gsPageScale() { | |||||
| # Prints GS call for scaling | # Prints GS call for scaling | ||||
| gsPrintPageScale() { | gsPrintPageScale() { | ||||
| local _call_str="" | |||||
| # Print Scale page command | # Print Scale page command | ||||
| cat << _EOF_ | |||||
| "$GSBIN" \ | |||||
| read -d '' _call_str<< _EOF_ | |||||
| "$GSBIN" \ | |||||
| -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dSAFER \ | -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dSAFER \ | ||||
| -dCompatibilityLevel="1.5" -dPDFSETTINGS="$PDF_SETTINGS" \ | -dCompatibilityLevel="1.5" -dPDFSETTINGS="$PDF_SETTINGS" \ | ||||
| -dColorImageResolution=$IMAGE_RESOLUTION -dGrayImageResolution=$IMAGE_RESOLUTION \ | -dColorImageResolution=$IMAGE_RESOLUTION -dGrayImageResolution=$IMAGE_RESOLUTION \ | ||||
| @@ -285,8 +286,10 @@ gsPrintPageScale() { | |||||
| -dDEVICEWIDTHPOINTS=$PGWIDTH -dDEVICEHEIGHTPOINTS=$PGHEIGHT \ | -dDEVICEWIDTHPOINTS=$PGWIDTH -dDEVICEHEIGHTPOINTS=$PGHEIGHT \ | ||||
| -sOutputFile="$OUTFILEPDF" \ | -sOutputFile="$OUTFILEPDF" \ | ||||
| -c "<</BeginPage{$SCALE $SCALE scale $XTRANS $YTRANS translate}>> setpagedevice" \ | -c "<</BeginPage{$SCALE $SCALE scale $XTRANS $YTRANS translate}>> setpagedevice" \ | ||||
| -f "$INFILEPDF" | |||||
| -f "$INFILEPDF" | |||||
| _EOF_ | _EOF_ | ||||
| echo -ne "$_call_str" | |||||
| } | } | ||||
| # Runs the ghostscript paper resize script | # Runs the ghostscript paper resize script | ||||
| @@ -299,7 +302,7 @@ pageResize() { | |||||
| runFlipDetect | runFlipDetect | ||||
| vprint " Run Resizing: $(uppercase "$RESIZE_PAPER_TYPE") ( "$RESIZE_WIDTH" x "$RESIZE_HEIGHT" ) pts" | vprint " Run Resizing: $(uppercase "$RESIZE_PAPER_TYPE") ( "$RESIZE_WIDTH" x "$RESIZE_HEIGHT" ) pts" | ||||
| GS_RUN_STATUS="$GS_RUN_STATUS""$(gsPageResize 2>&1)" | GS_RUN_STATUS="$GS_RUN_STATUS""$(gsPageResize 2>&1)" | ||||
| GS_CALL_STRING="$GS_CALL_STRING"$'[GS RESIZE CALL STARTS]\n'"$(gsPrintPageScale)"$'\n[GS RESIZE CALL ENDS]\n' | |||||
| GS_CALL_STRING="$GS_CALL_STRING"$'[GS RESIZE CALL STARTS]\n'"$(gsPrintPageResize)"$'\n[GS RESIZE CALL ENDS]\n' | |||||
| return $? | return $? | ||||
| } | } | ||||
| @@ -327,7 +330,9 @@ gsPageResize() { | |||||
| # Prints GS call for resizing | # Prints GS call for resizing | ||||
| gsPrintPageResize() { | gsPrintPageResize() { | ||||
| # Print Resize page command | # Print Resize page command | ||||
| cat << _EOF_ | |||||
| local _call_str="" | |||||
| # Print Scale page command | |||||
| read -d '' _call_str<< _EOF_ | |||||
| "$GSBIN" \ | "$GSBIN" \ | ||||
| -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dSAFER \ | -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dSAFER \ | ||||
| -dCompatibilityLevel="1.5" -dPDFSETTINGS="$PDF_SETTINGS" \ | -dCompatibilityLevel="1.5" -dPDFSETTINGS="$PDF_SETTINGS" \ | ||||
| @@ -341,6 +346,8 @@ gsPrintPageResize() { | |||||
| -sOutputFile="$OUTFILEPDF" \ | -sOutputFile="$OUTFILEPDF" \ | ||||
| -f "$INFILEPDF" | -f "$INFILEPDF" | ||||
| _EOF_ | _EOF_ | ||||
| echo -ne "$_call_str" | |||||
| } | } | ||||
| # Returns $TRUE if we should use the source paper size, $FALSE otherwise | # Returns $TRUE if we should use the source paper size, $FALSE otherwise | ||||