Skip to content

Commit 7373d4f

Browse files
authored
ver 2.5.9 - fix for -dNEWPDF, added MIT license
1 parent 1754200 commit 7373d4f

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

pdfScale.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Writen for Bash.
1010
#
1111
# Gustavo Arnosti Neves - 2016 / 07 / 10
12-
# Latest Version - 2023 / 01 / 26
12+
# Latest Version - 2024 / 07 / 16
1313
#
1414
# This app: https://github.com/tavinus/pdfScale
1515
#
@@ -18,9 +18,11 @@
1818
# that helped and donated. It has been a long run with this
1919
# script. I wish you all the best! -]
2020
#
21+
# Ver 2.5.9 Added MIT License
22+
#
2123
################################################################
2224

23-
VERSION="2.5.8"
25+
VERSION="2.5.9"
2426

2527

2628
###################### EXTERNAL PROGRAMS #######################
@@ -108,6 +110,7 @@ SIMULATE=$FALSE # Avoid execution
108110
PRINT_GS_CALL=$FALSE # Print GS Call to stdout
109111
GS_CALL_STRING="" # Buffer
110112
RESIZECOMMANDS="" # command to run on resize call
113+
GSNEWPDF="" # for -dNEWDPF flag
111114

112115
############################# Project Info
113116
PROJECT_NAME="pdfScale"
@@ -291,8 +294,7 @@ gsPageScale() {
291294
-dSubsetFonts=true -dEmbedAllFonts=true \
292295
-dDEVICEWIDTHPOINTS=$PGWIDTH -dDEVICEHEIGHTPOINTS=$PGHEIGHT \
293296
$DPRINTED \
294-
-sOutputFile="$OUTFILEPDF" \
295-
-dNEWPDF=false \
297+
-sOutputFile="$OUTFILEPDF" $GSNEWPDF \
296298
-c "<</BeginPage{$BACKGROUNDCALL$SCALE $SCALE scale $XTRANS $YTRANS translate}>> setpagedevice" \
297299
-f "$INFILEPDF"
298300

@@ -312,8 +314,7 @@ gsPrintPageScale() {
312314
-dSubsetFonts=true -dEmbedAllFonts=true \
313315
-dDEVICEWIDTHPOINTS=$PGWIDTH -dDEVICEHEIGHTPOINTS=$PGHEIGHT \
314316
$DPRINTED \
315-
-sOutputFile="$OUTFILEPDF" \
316-
-dNEWPDF=false \
317+
-sOutputFile="$OUTFILEPDF" $GSNEWPDF \
317318
-c "<</BeginPage{$BACKGROUNDCALL$SCALE $SCALE scale $XTRANS $YTRANS translate}>> setpagedevice" \
318319
-f "$INFILEPDF"
319320
_EOF_
@@ -364,8 +365,7 @@ gsPageResize() {
364365
-dSubsetFonts=true -dEmbedAllFonts=true \
365366
-dDEVICEWIDTHPOINTS=$RESIZE_WIDTH -dDEVICEHEIGHTPOINTS=$RESIZE_HEIGHT \
366367
-dAutoRotatePages=$AUTO_ROTATION \
367-
-dFIXEDMEDIA $FIT_PAGE $DPRINTED \
368-
-dNEWPDF=false \
368+
-dFIXEDMEDIA $FIT_PAGE $DPRINTED $GSNEWPDF \
369369
-sOutputFile="$OUTFILEPDF" -c "$RESIZECOMMANDS" \
370370
-f "$INFILEPDF"
371371
return $?
@@ -386,8 +386,7 @@ gsPrintPageResize() {
386386
-dSubsetFonts=true -dEmbedAllFonts=true \
387387
-dDEVICEWIDTHPOINTS=$RESIZE_WIDTH -dDEVICEHEIGHTPOINTS=$RESIZE_HEIGHT \
388388
-dAutoRotatePages=$AUTO_ROTATION \
389-
-dFIXEDMEDIA $FIT_PAGE $DPRINTED \
390-
-dNEWPDF=false \
389+
-dFIXEDMEDIA $FIT_PAGE $DPRINTED $GSNEWPDF \
391390
-sOutputFile="$OUTFILEPDF" -c "$RESIZECOMMANDS" \
392391
-f "$INFILEPDF"
393392
_EOF_
@@ -532,6 +531,10 @@ getOptions() {
532531
parseMode "$1"
533532
shift
534533
;;
534+
--newpdf|--dnewpdf)
535+
GSNEWPDF="-dNEWPDF=false"
536+
shift
537+
;;
535538
-r|--resize)
536539
shift
537540
parsePaperResize "$1"
@@ -2299,6 +2302,7 @@ Parameters:
22992302
Creates a background with a RGB color setting on PDF scaling
23002303
Must be quoted into a single parameter as in \"100 100 200\"
23012304
RGB numbers are integers between 0 and 255 (255 122 50)
2305+
--newpdf Uses the -dNEWPDF flag in the GS Call (deprecated in new versions of GS)
23022306
--dry-run, --simulate
23032307
Just simulate execution. Will not run ghostscript
23042308
--print-gs-call, --gs-call

0 commit comments

Comments
 (0)