Skip to content

Commit

Permalink
v2.6.3 - FixTemp - Makes the temporary file use the output path and f…
Browse files Browse the repository at this point in the history
…ile name as basis again (intead of the input file/path).
  • Loading branch information
tavinus committed Jul 22, 2024
1 parent 6cc3b24 commit ca780e0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pdfScale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#
################################################################

VERSION="2.6.2"
VERSION="2.6.3"


###################### EXTERNAL PROGRAMS #######################
Expand Down Expand Up @@ -77,6 +77,7 @@ RESIZE_HEIGHT="" # Resized PDF Page Height
PAGE_RANGE="" # Pages to be processed (feeds -sPageList)
PAGE_COUNT="" # To store the PDF page count
PAGE_SIZES=() # To list all page sizes
EXPLODE_SUFFIX='.Page%d' # Suffix for exploded pages

############################# Image resolution (dpi)
IMAGE_RESOLUTION=300 # 300 is /Printer default
Expand Down Expand Up @@ -157,8 +158,9 @@ main() {
initMain " Mixed Tasks: Resize & Scale"
local tempFile=""
local tempSuffix="$RANDOM$RANDOM""_TEMP_$RANDOM$RANDOM.pdf"
outputFile="$OUTFILEPDF" # backup outFile name
tempFile="${INFILEPDF%.pdf}.$tempSuffix" # set a temp file name
outputFile="$OUTFILEPDF" # backup outFile name
tempFile="${OUTFILEPDF%.pdf}" # set temp file, remove .pdf extension
tempFile="${tempFile%$EXPLODE_SUFFIX}.$tempSuffix" # remove explode and add temp suffix
if isFile "$tempFile"; then
printError $'Error! Temporary file name already exists!\n'"File: $tempFile"$'\nAborting execution to avoid overwriting the file.\nPlease Try again...'
exit $EXIT_TEMP_FILE_EXISTS
Expand Down Expand Up @@ -223,7 +225,7 @@ initMain() {
vprint " Dry-Run: $sim"
vPrintFileInfo
local exp="Disabled"
isExplodeMode && local exp="Enabled"
isExplodeMode && exp="Enabled"
vprint " Explode PDF: $exp"
getPageSize
vPrintRange
Expand Down

0 comments on commit ca780e0

Please sign in to comment.