File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change 1- #! /bin/sh
1+ #! /usr/ bin/env bash
22#
33# PDF Font Embedder
44# Copyright (C) 2009-2025 by Thomas Dreibholz
19192020#
2121
22+ # Bash options:
23+ set -eu
24+
2225# ====== Get arguments ======================================================
2326if [ $# -lt 2 ] ; then
2427 echo >&2 " Usage: $0 [Input PDF] [Output PDF] {-optimize}"
@@ -33,23 +36,18 @@ if [ "$3" = "-optimize" ] ; then
3336 OPTIMIZE=1
3437fi
3538
36- if [ ! -e " $INPUT_PDF " ] ; then
37- echo >&2 " ERROR: PDF file $INPUT_PDF does not exist!"
39+ if [ ! -e " ${ INPUT_PDF} " ] ; then
40+ echo >&2 " ERROR: PDF file ${ INPUT_PDF} does not exist!"
3841 exit 1
3942fi
4043
4144
4245# ====== Perform conversion =================================================
43- # ------ Using PDF -> PS -> PDF ---------------------------
44- # ( ps2pdf -dPDFSETTINGS=/prepress -dLanguageLevel=3 $1 - | \
45- # ps2pdf -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 - $2-tmp.pdf && \
46- # qpdf --linearize $2-tmp.pdf $2 ) || cp $1 $2
47- # rm -f $2-tmp.pdf
48-
49- # ------ Using PDF/X --------------------------------------
50- if [ $OPTIMIZE -eq 1 ] ; then
51- ( ps2pdf -dPDFX $1 $2 -tmp.pdf && qpdf --linearize $2 -tmp.pdf $2 ) || cp $1 $2
52- rm -f $2 -tmp.pdf
46+
47+ # ------ Using PDF/X --------------------------------------------------------
48+ if [ ${OPTIMIZE} -eq 1 ] ; then
49+ ( ps2pdf -dPDFX " ${INPUT_PDF} " " ${OUTPUT_PDF} " -tmp.pdf && qpdf --linearize " ${OUTPUT_PDF} " -tmp.pdf " ${OUTPUT_PDF} " ) || cp " ${INPUT_PDF} " " ${OUTPUT_PDF} "
50+ rm -f " ${OUTPUT_PDF} " -tmp.pdf
5351else
54- ps2pdf -dPDFX $1 $2
52+ ps2pdf -dPDFX " ${INPUT_PDF} " " ${OUTPUT_PDF} "
5553fi
You can’t perform that action at this time.
0 commit comments