]> gitweb.hhaalo.de Git - scantopdf.git/commitdiff
change one pdf tiff to pdf convert
authorBastian Dehn <hhaalo@arcor.de>
Mon, 24 Nov 2025 18:59:49 +0000 (19:59 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Mon, 24 Nov 2025 19:01:45 +0000 (20:01 +0100)
src/scanbasic.sh
tests/scanbasic.bats

index e4a9250615e11cb09d4351d3189f305d18f7e281..f72daef2ce1437109f1a8ba42c8f44246423ad44 100644 (file)
@@ -103,17 +103,10 @@ createonepdf()
                || errlog "missing output" \
                || return $?
 
-       local output_pdf=
-       local tiff=
-       for tiff in scanned-$$-*.tiff; do
-               output_pdf=${tiff/.tiff/.pdf}
-               tiff2pdf $tiff -o $output_pdf \
-                       || errlog "could not convert tiff to pdf" \
-                       || return $?
-               rm $tiff \
-                       || errlog "could not delete $tiff" \
-                       || return $?
-       done
+       export -f convert_tiff_to_pdf
+       find scanned-$$-*.tiff \
+               | sort \
+               | parallel convert_tiff_to_pdf {}
 
        pdftk scanned-$$-*.pdf output $output \
                || errlog "could not convert into single $output" \
index 31a4c8151cab6c910082343cc180a54d26158ca7..41e383ea111d2bd755deabe5c41080b4bda4d840 100755 (executable)
@@ -90,17 +90,6 @@ setup() {
        assert_line --index 0 "❌ ERROR: missing output"
 }
 
-@test "should failure createonepdf tiff2pdf fails" {
-       tiff2pdf() {
-               return 1
-       }
-
-       run createonepdf "testfile"
-
-       assert_failure
-       assert_line --index 0 "❌ ERROR: could not convert tiff to pdf"
-}
-
 @test "should failure createonepdf pdftk fails" {
        tiff2pdf() {
                :
@@ -108,6 +97,9 @@ setup() {
        rm() {
                :
        }
+       find() {
+               :
+       }
        pdftk() {
                return 1
        }