Ubuntu – trying to get brother all in one to output PDF files

pdfprinting

OK … first off, I know nothing about linux … learning on the fly…. only tried it for two weeks so far. Got it installed. Managed to set up a network between windows and linux.

I am trying to install a Brother MFC-J6935DW all in one printer/scanner… set up as a network unit (Ethernet).

Got the drivers off the brother site … installed with no problems. Printer works great.

Scanner would not recognize the the computer. Found an answer on this site that had me load brscan-skey and now the printer sees the linux computer ( also sees the windows 7 and 10 units on the network).

Problem …. scanner only scans 1 page even if 5 pages go through the document feed and the output is a PNM file.

So I want to get a PDF output (and if there are multiple pages they should be in one PDF file).

Brother has been of no help … they keep telling me to just re-install the drivers.

I found three possible solutions … there may be more …. but I have not idea if any of these will work.

1) python scanpdf 0.3.1 I am not sure how to use this but it looks like this may do what I want. Needs something called ImageMagick and SANE (I "think" sane is already installed). heck, I don't even know what python is?

2) I was told there is a program called gscan2pdf

3) Found this link: brother support page

This does have a note (NOTE:scanadf, pnmtops, and ps2pdf need to be installed) not sure how to set any of these up if I do find and install them.

Here is my file, do I just replace it with the above of modify mine or ????

#! /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"
scanimage --device-name "$device" --resolution $resolution> $output_file 2>/dev/null
if [ ! -s $output_file ];then
if [ "`which usleep 2>/dev/null `" != '' ];then
usleep 1000000
else
sleep 1
fi
scanimage --device-name "$device" --resolution $resolution> $output_file 2>/dev/null
fi
echo $output_file is created.

Any help would be greatly appreciated!

Best Answer

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 to scanadf,
  • 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).

Related Question