Skip to content

Commit ca780e0

Browse files
committed
v2.6.3 - FixTemp - Makes the temporary file use the output path and file name as basis again (intead of the input file/path).
1 parent 6cc3b24 commit ca780e0

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

pdfScale.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#
2323
################################################################
2424

25-
VERSION="2.6.2"
25+
VERSION="2.6.3"
2626

2727

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

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

0 commit comments

Comments
 (0)