setup scanner CanoScan LiDE 200 [debian]

based on:
http://sane-project.org/
http://sane-project.org/cgi-bin/driver.pl?manu=canon&model=lide+25&bus=any&v=&p=
http://linux.die.net/man/1/pnmtopng

install sane:
sudo apt-get install sane

List available scanners:
scanimage -L

help for device:
scanimage --help -d Canon

list all available backend options:
scanimage -A

possible commands to add to scanimage:
--mode Color|Gray|Lineart [Gray]
--resolution 4800|2400|1200|600|300|200|150|100|75dpi [75]
--format=pnm|tiff file format of output file

scan from terminal for example like this:
scanimage --mode Gray --resolution 150 --progress > ~/Schreibtisch/image.pnm #greyscaled
scanimage --mode Color --resolution 150 --progress > ~/Schreibtisch/image.pnm #color
scanimage --mode Lineart --resolution 150 --progress > ~/Schreibtisch/image.pnm #Lineart

create a bash script for scan and convert to png to pdf:
cd ~/
touch .scn_pnm2png2pdf.sh
chmod +x .scn_pnm2png2pdf.sh
nano .scn_pnm2png2pdf.sh

then paste the following code:

#!/bin/bash
STR=`date +%s`
scanimage --mode Color --resolution 150 --progress > ~/Schreibtisch/$STR.pnm
pnmtopng ~/Schreibtisch/$STR.pnm > ~/Schreibtisch/$STR.png
rm ~/Schreibtisch/$STR.pnm
convert  ~/Schreibtisch/$STR.png  ~/Schreibtisch/$STR.pdf
rm ~/Schreibtisch/$STR.png

install imagemagick (needed to convert from png to pdf):
sudo apt install imagemagick

start the script from terminal with:
./.scn_pnm2png2pdf.sh

you will find the png pictures pdf files on your “Schreibtisch”

create a starter:
get an icon:
mkdir ‐p ~/.local/share/icons/
cd ~/.local/share/icons/
wget https://raw.githubusercontent.com/encharm/Font-Awesome-SVG-PNG/master/black/svg/barcode.svg

cd ~/.local/share/applications
nano scan2pdf.desktop

[Desktop Entry]
Name=scan2pdf
Comment=get a scanned pdf on 'Schreibtisch'
Exec=/home/xxUserxx/.scn_pnm2png2pdf.sh
Icon=/home/xxUserxx/.local/share/icons/barcode.svg
Terminal=false
Type=Application
Categories=System;Utility;Application;

use the correct username in starter:
cd ~/.local/share/applications
sed -i 's/xxUserxx/'$USER'/' scan2pdf.desktop

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s