[plug] Creating multiple-page PDFs from scanned images [SOLVED]

Alex Nordstrom lx at se.linux.org
Thu Jan 18 17:19:29 WST 2007


A while ago, I posed a question about scanning multiple-page documents 
into PDF documents. For the completeness of the archives, here's what I 
came up with, in the hope that someone might find it useful.

I was having problems using convert from ImageMagick to convert images 
to PDF. Upgrading ImageMagick, getting another 512 megs of RAM, using 
input already converted to PDF documents, using certain convert 
options, or a combination of these factors seems to have solved the 
problem.

I hacked up the attached Perl script to perform the batch scanning. It 
takes a single optional argument: the directory in which to place the 
scanned images, named 001.pdf, 002.pdf, 003.pdf and so on in the 
directory given. If no directory is provided, the current working 
directory is used.

The script prompts the user to place the first page of the document in 
the scanner and enter the number of pages in the document. It then 
scans the page and prompts the user to prepare the next page and press 
enter, until all pages in the document have been scan. At this point, 
the pages are merged and given a sequential file name. It then starts 
over, prompting for the number of pages in the next document.

It requires convert from ImageMagick, scanimage from sane-utils, and 
tempfile from debianutils (because I'm too lazy to deal with Perl's way 
of creating temp files). You'll have to change the device to the 
appropriate device given by scanimage -L.

The resulting documents are on the order of 100 KiB per page, but this 
can be tweaked by changing the default resolution, colour mode, and 
compression.

It's in the public domain and probably riddled with bugs for which I 
take full credit but no responsibility. Enjoy!

-- 
Alex Nordstrom
http://lx.n3.net/
Please do not CC me in followups; I am subscribed to plug.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: batchscan.pl
Type: application/x-perl
Size: 1726 bytes
Desc: not available
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20070118/7d98eb67/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20070118/7d98eb67/attachment.pgp>


More information about the plug mailing list