Hello!
Many of you have probably encountered a situation when you need to implement network scanning in the office through Linux. I got in some way something like that, but a little on the other side. We have: the main office with the main terminal server (Windows Server 2008R2), with a dozen branches scattered around the city, connected to the server via VPN tunnels. At each point, the same equipment - HP mini netbook (was with OpenSuse, but interrupted for Debian 6.0) and HP LaserJet M1214 multifunction printer. Task: to realize the ability of the user to scan documents on the server. Since a single application is running on the server for a user (1C client), for him it should look like “clicked on a button - a scan in the database”.
How it was supposed to be done: the MFP is networked and can scan over the network. So the user simply chooses his scanner and everything is fine. It was not there. It turned out that the MFP can not work as a network scanner simultaneously installed on one PC (in this case, the server). Whichever scanner is selected, the last one installed is always scanned. The answer of HP technical support finally buried this option. In short, the answer was: "This is impossible."
Changing equipment is not an option - it is expensive for us (at our expense in practice, since the TK scan should work) and costly for the client.
So you need to force to scan the MFP "locally" on the netbook and transfer the scan to the server. In this case, the user must do this from the terminal - press the button and wait.
It is good that there is such a project as HPLIP. The first attempt to screw the MFP to the netbook failed - the version in Debian is not the newest, and it does not have support for the HP LJ M1214. I had to download and compile the latest version. Here the MFP is remarkably recognized and earned, both for printing and scanning.
Next, it was necessary to automate the scanning process. For the beginning, a simple script was created that launches a scan, saving the result in / tmp / scan and converting it to jpg.
scan.sh:
The parameter for the script is the name suffix.
Scan quality is not very good, but for the client it is sufficient. One scan is about 300-400 kb. Scans quickly and the base does not score much.
Now it is necessary to force this script to be executed remotely from under the terminal. Here the set of utilities of the wonderful Putty project helped. Or rather, two utilities - plink.exe and pscp.exe. The first one sends the scan command, and the second one takes the result. As a result of trial and error, the following bat file was created:
c:\putty\plink.exe 192.168.%1.100 -l root -pw mypass /bin/scan.sh %2
c:\putty\pscp.exe -pw mypass root@192.168.%1.100:/tmp/scan/*.jpg %3
Each branch has a number and it coincides with the last number of the subnet that is passed to the first parameter. And the host number is around 100. The second parameter is the name suffix for the image. The third is the place on the server where to store the tempo scans until they have been grabbed for 1s. Well, after that, 1c programmers made the coveted “Scan” button, which launched the batch file with the parameters for this user.
In order not to make manipulations on the installation and configuration of HPLIP at each point from scratch, an image was made that greatly reduced the time spent working on one point — an average of half an hour.
In general, this system has been working without failures for 2 months already.
Thanks for attention!