From 57b38d489b4527d25e12bcf6b8e502c212807289 Mon Sep 17 00:00:00 2001 From: Tom Vercauteren Date: Wed, 4 Dec 2024 22:11:37 +0000 Subject: [PATCH] replacing call to outdated smpdf executable --- tools/compresspdf2ebookpdf | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/tools/compresspdf2ebookpdf b/tools/compresspdf2ebookpdf index 2a88300..17ab2a2 100755 --- a/tools/compresspdf2ebookpdf +++ b/tools/compresspdf2ebookpdf @@ -25,13 +25,7 @@ echo "PDF lossy compression using:" echo $PDF2PDFFLAGS -sOutputFile="$F-compressed.pdf" "$1" $pdfmarks gs $PDF2PDFFLAGS -sOutputFile="$F-compressed.pdf" "$1" $pdfmarks -# pdftk is not maintained anymore and does not work on my mac... -#echo pdftk $1 dump_data output /tmp/pdftk-report.txt -#pdftk $1 dump_data output /tmp/pdftk-report.txt -#echo pdftk /tmp/compressed.pdf update_info /tmp/pdftk-report.txt output $F-compressed.pdf -#pdftk /tmp/compressed.pdf update_info /tmp/pdftk-report.txt output $F-compressed.pdf - -# Chrome has issues if exiftool is run last. Make sure smpdf comes afterwards +# Chrome has issues if exiftool is run last. Make sure cpdf comes afterwards if ! [ -x "$(command -v exiftool)" ]; then echo "Could not find exiftool - Some tags might have been lost" else @@ -41,21 +35,16 @@ else exiftool -overwrite_original -TagsFromFile "$1" "$F-compressed.pdf" fi -if ! [ -x "$(command -v smpdf)" ]; then - echo "Could not find smpdf - Skipping additional lossless compression" - echo See https://www.coherentpdf.com/compression.html +if ! [ -x "$(command -v cpdf)" ]; then + echo "Could not find cpdf - Skipping additional lossless compression and annotation copying" + echo "See https://github.com/johnwhitington/cpdf-source" else # Use smpdf to further compress the file in a lossless fashion echo "PDF lossless compression using:" - echo smpdf "$F-compressed.pdf" -o "$F-compressed2.pdf" - smpdf "$F-compressed.pdf" -o "$F-compressed2.pdf" + echo cpdf -squeeze "$F-compressed.pdf" -o "$F-compressed2.pdf" + cpdf -squeeze "$F-compressed.pdf" -o "$F-compressed2.pdf" mv "$F-compressed2.pdf" "$F-compressed.pdf" -fi - -if ! [ -x "$(command -v cpdf)" ]; then - echo "Could not find cpdf - Skipping additional annotation copying" - echo See https://www.coherentpdf.com/compression.html -else + # Use cpdf to copy information over echo "PDF ID copy using:" echo cpdf -copy-id-from "$1" "$F-compressed.pdf" -o "$F-compressed2.pdf"