diff --git a/README.md b/README.md index aeedc57..9dcb0f1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ picture per page. This utility requires the following tools to be installed: ```shell -apt install imagemagick pdfjam pdftk +apt install imagemagick pdfjam qpdf ``` ## Installation diff --git a/photos2pdf b/photos2pdf index c1d97f3..8c26588 100755 --- a/photos2pdf +++ b/photos2pdf @@ -407,22 +407,23 @@ for png in "$outdir/"*.png ; do warning "Could not convert \"$png\" to PDF; skipped." rv=1 continue - elif ! pdfjam \ - --quiet \ - --outfile "$tmpdir" \ - --paper "$paper" \ - "$jam_landscape" \ - --scale "$scale" \ - --offset "$offset" \ - "$pdf" + elif ! \ + pdfjam \ + --quiet \ + --outfile "$tmpdir" \ + --paper "$paper" \ + "$jam_landscape" \ + --scale "$scale" \ + --offset "$offset" \ + "$pdf" then warning "Could not align \"$pdf\"; skipped." rv=1 continue - elif ! pdftk \ + elif ! qpdf \ "$jammed" \ - stamp "$backdrop" \ - output "$backdropped" + --overlay "$backdrop" \ + -- "$backdropped" then warning "Could not watermark \"$pdf\"; skipped." rv=1 @@ -436,7 +437,12 @@ while read -r pdf ; do input+=("$pdf") done < <(ls -- "$tmpdir/"*.backdropped.pdf) -if ! pdftk "${input[@]}" cat output "$pdfdir/$result_filename" ; then +if ! \ + qpdf \ + --empty \ + --pages "${input[@]}" \ + -- "$pdfdir/$result_filename" +then warning "Could not concatenate \"$result_filename\"." rv=1 elif ! "$keep_tmpfiles" ; then