trying to get brother all in one to output PDF files
Solution 1:
This issue originates from the fact that scanimage
is supposed to only capture single page from the scanner. For scanning multiple pages, there's a scanadf
(ADF - automatic document feeder) utility.
The program provided by you, adapted to use scanadf
:
#! /bin/sh
set +o noclobber
#
# $1 = scanner device
# $2 = friendly name
#
#
# 100,200,300,400,600
#
resolution=100
device=$1
mkdir -p ~/brscan
if [ "`which usleep 2>/dev/null `" != '' ];then
usleep 100000
else
sleep 0.1
fi
output_file=~/brscan/brscan_"`date +%Y-%m-%d-%H-%M-%S`"".pnm"
#echo "scan from $2($device) to $output_file"
scanadf --device-name "$device" --resolution $resolution -o "$output_file"_%04d 2>/dev/null
convert -page A4 -density 100 $output_file* "$output_file"".pdf" 2>/dev/null
echo $output_file is created.
I introduced following changes:
- changed
scanimage
toscanadf
, - added argument
-o "$output_file"_%04d
- this will saved scanned pages to files with of format "brscan_CURRENT_DATE.pnm_NUMBER", with number from 1 to how many pages you scan, - added
convert
program, that will convert and combine scanned files into single PDF file the script from Brother does not do that by default
convert
requires having ImageMagick - a free image manipulation software to be installed on your computer to work. Moreover, convert
requires additional configuration to allow operations on PDF files, see https://askubuntu.com/a/1081907 for more information on that topic.
This solution is based on notes provided on Brother's support page (https://support.brother.com/g/s/id/linux/en/instruction_scn5.html?lang=en).