mirror of
https://codeberg.org/h3xx/optipdf
synced 2024-08-15 00:03:23 +00:00
Add more qpdf options for smaller file sizes
This commit is contained in:
parent
a6a00d300c
commit
38411917a9
1 changed files with 16 additions and 3 deletions
19
optipdf
19
optipdf
|
@ -2,6 +2,7 @@
|
|||
# vi: et sts=4 sw=4 ts=4
|
||||
|
||||
PRESERVE_TIMESTAMP=0
|
||||
LOSSY=0
|
||||
KEEP_BACKUP_SUFFIX=.old-unoptimized
|
||||
|
||||
TEMP_FILES=()
|
||||
|
@ -126,6 +127,20 @@ use_smaller() {
|
|||
TEMP=$(mktemp -t "${0##*/}.XXXXXX")
|
||||
TEMP_FILES+=("$TEMP")
|
||||
|
||||
QPDF_ARGS=(
|
||||
--compression-level=9
|
||||
--deterministic-id
|
||||
--object-streams=generate
|
||||
--recompress-flate
|
||||
--stream-data=compress
|
||||
)
|
||||
|
||||
if [[ $LOSSY -ne 0 ]]; then
|
||||
QPDF_ARGS+=(
|
||||
--optimize-images
|
||||
)
|
||||
fi
|
||||
|
||||
ERRORS=0
|
||||
FREED_TOTAL=0
|
||||
for FILE; do
|
||||
|
@ -133,9 +148,7 @@ for FILE; do
|
|||
BEGIN_FILESIZE=$(file_size "$FILE")
|
||||
|
||||
if
|
||||
qpdf \
|
||||
--recompress-flate \
|
||||
--stream-data=compress \
|
||||
qpdf "${QPDF_ARGS[@]}" \
|
||||
-- \
|
||||
"$FILE" "$TEMP" &&
|
||||
use_smaller "$FILE" "$TEMP"; then
|
||||
|
|
Loading…
Reference in a new issue