diff options
-rw-r--r-- | hm/soispha/pkgs/scripts/apps/con2pdf | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/hm/soispha/pkgs/scripts/apps/con2pdf b/hm/soispha/pkgs/scripts/apps/con2pdf index 56ed613f..b4d88712 100644 --- a/hm/soispha/pkgs/scripts/apps/con2pdf +++ b/hm/soispha/pkgs/scripts/apps/con2pdf @@ -90,7 +90,7 @@ process_images_adf() { if [ "$counter" = "$number_of_pages" ]; then dbg "$counter == $number_of_pages" counter=0; - convert_images_flatbed "$image_cache" "${name}_$pdf_counter" "$output_directory" + convert_images "$image_cache" "${name}_$pdf_counter" "$output_directory" : $((pdf_counter += 1)) printf "" > "$image_cache" fi @@ -123,14 +123,14 @@ process_images_flatbed() { : $((counter += 1)) if [ "$counter" = "$number_of_pages" ]; then counter=0; - convert_images_flatbed "$image_cache" "$name" "$output_directory" + convert_images "$image_cache" "$name" "$output_directory" printf "" > "$image_cache" fi done < "$(tmp_pipe fd . "$tiff_temp_path" "|" sort -V)" } -convert_images_flatbed() { +convert_images() { image_cache="$1"; - name="$2"; + pdf_name="$2"; output_dir="$3"; set -- @@ -139,11 +139,11 @@ convert_images_flatbed() { set -- "$@" "$image" done < "$image_cache" - while [ -e "$output_dir/${name}.pdf" ]; do - name="${name}_$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 25)" + while [ -e "$output_dir/${pdf_name}.pdf" ]; do + pdf_name="${pdf_name}_$(tr -dc 'A-Za-z0-9' </dev/urandom | head -c 25)" done - dbg "using name: $name"; - convert "$@" -compress jpeg -quality 100 "$output_dir/${name}.pdf" + dbg "using pdf_name: $pdf_name"; + convert "$@" -compress jpeg -quality 100 "$output_dir/${pdf_name}.pdf" } scan() { |