I was successful with your scan2pc.sh script for a Samsung SL-C472W model which has flat-bed scanner. Thank you. I tested at the environment of ubuntu 22.04 docker container with the suldr-driver2 and the packages you mentioned installed.
One thing I would like to comment about your script is that it won't work due to the imagemagick's pdf security policy problem. So in order to work properly just one line in the script needs to be modified like below.
--- scanimage $Verbose -d 'smfp:net;'$SCANNER_IP --resolution $DPI --page-format $ScanSize --format jpeg |
convert $COLOR - "$FileName"
+++ scanimage $Verbose -d 'smfp:net;'$SCANNER_IP --resolution $DPI --page-format $ScanSize --format ${FileType,,[A-Z]} --output-file "$FileName"
One thing I would like to comment about your script is that it won't work due to the imagemagick's pdf security policy problem. So in order to work properly just one line in the script needs to be modified like below.
--- scanimage $Verbose -d 'smfp:net;'$SCANNER_IP --resolution $DPI --page-format $ScanSize --format jpeg |
convert $COLOR - "$FileName"
+++ scanimage $Verbose -d 'smfp:net;'$SCANNER_IP --resolution $DPI --page-format $ScanSize --format ${FileType,,[A-Z]} --output-file "$FileName"