PHP Classes

PHP Document Scanner using SANE or eSCL AirPrint: Web interface to scan printed documents

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 192 All time: 8,570 This week: 46Up
Version License PHP version Categories
airscan 1.0.0Free for non-comm...5PHP 5, Graphics, Printing
Description 

Author

This package provides a Web interface to scan printed documents via the SANE or eSCL .

It provides a Web based user interface to allow scanning printed documents using a regular browser to convert the scanned images to JPEG or PDF formats.

The package uses the SANE or eSCL AirPrint and supports many scanners like Century CPS-A4WF Halo Magic Scanner ION AirCopy, ION AirCopy E-Post Edition, iScan Fly, Kaiser Baas WiFi Photo & Document Scanner, Mustek iScan Air / S400W, Transcription Patri Kun A4 Wi-Fi Portable Scanner.

Innovation Award
PHP Programming Innovation award nominee
March 2020
Number 11
Scanning important documents is useful for many people or business that need to digitize printed documents, so they can access them from any where in the world where there is an Internet access.

This package provides a PHP based solution to help scanning printed documents using a Web interface, so the scanned document files can be view later from the Internet anytime.

Manuel Lemos
Picture of Mark de Leon
Name: Mark de Leon <contact>
Classes: 1 package by
Country: United States United States
Innovation award
Innovation award
Nominee: 1x

 

Documentation

AirScan

eSCL and SANE support for:

Century CPS-A4WF

Halo Magic Scanner

ION AirCopy

ION AirCopy E-Post Edition

iScan Fly


Kaiser Baas WiFi Photo & Document Scanner

Mustek iScan Air / S400W

Transcription Patri Kun A4 Wi-Fi Portable Scanner

???????? A4 Wi-Fi??????????

This software , I felt was not ready for release then I discoverd sane-airscan (https://github.com/alexpevzner/sane-airscan) and found the two to be fully compatible. I felt Linux users may need this. Now despite the eSCL/AirScan not being fully functonal from OSX and Mopria I decided to release it for the benefit of Linux SANE users. There remains some sloppy code and test files, etc. Hopefully over time it will get cleaned up.

This software stand-alone:

eSCL/AirPrnt functionality for OSX and Mopria is incomplete, however it will get you a scanner GUI from which you can scan with a web browser.


This software with sane-airscan:

This software combined with sane-airscan (https://github.com/alexpevzner/sane-airscan) as described below will give you SANE support for this scanner.

This software with your command line scanner under linux:

I am interested in anyone who may have created a command line scanner for any scanner not otherwise supported in SANE. As I can fairly easily modify this software to accommodate your comand line scanner.

SANE support is a 2 part process. You will need:

This version of AirScan

and

https://github.com/alexpevzner/sane-airscan

AirScan is a web GUI and eSCL interface for these scanners. The host will advertise the scanner as an eSCL scanner on the network and process requests for it , translating scan comands to the scanner. It was tested entirely under Apache 2.4 and PHP 7 on Ubuntu 16.04 x86_64 and Debian on Raspberry Pi 3 . It can run on any Linux machine on your local network. It will provides a web GUI with Scanning to JPG or PDF , even multi-page PDF via the web GUI is available. It will also allow the scanner to be accessed via the software package listed below, which is a SANE back-end. The files are easily installable either to local machine or server. Most files are simply copied to web root directory, with a few exceptons. You will need on host machine: apache2 , PHP7, avahi-daemon , mod_dir, mod_rewrite, A wired or wireless interface to your LAN (wired recomended) , and an available wireless connection dedicated to connect to the scanner.

The second part of the software is the sane-airscan back-end. (Option A) You will need to install sane-airscan on all of the client machines (there are some repos for easy installaton), or (Option B) install sane-airscan on the same machine hosting the scanner and AirScan only . (Option C) is that the Scanner Host and user workstation may be the same linux machine already and sane-airsccan is also installed there.. Although sane-airscan was created for accessing eSCL/AirScan protocol scanners, it has been tested as working with the AirScan listed above.

Option A would share the scanner from the main host machine to other computers using the eSCL protocol. This is probably the preferred method in a multi-computer environment, unless you already have other SANE shared scanners.

Option B would share the scanner from the primary client machine to other client machines by way of SANE protocol.

Option C is recommended for a single computer, or sharing exclusively over SANE protocol.

As you can see there are various options for how to make it all work. Fear not, it is easy. I think option A or C are suitable for most environments. On other platforms, Vuescan for Windows, OSX, and Linux can use the scanner installed with option A , B or C becuase in any case the scanner will still advertise as eSCL.

UNTESTED:

Runnng on web servers other than Apache 2.4

PHP versins other than 7.0

Scanner Supported features/limitations:

Connect only via Wifi.

Mini USB is for charging only.

Should have only one WiFi client connected at a time.

Support jpg scannng only as the output format.

Support only 300 and 600 dpi resolutions

Single sheet feed scanners and there is no real "preview" available.

Micro SD slot on some models is not supported.

Using with SANE:

One can choose 300 or 600 dpi resolutons, the only two supported by the scanner.

Conversions to PDF in XSane were somewhat sketchy. This I believe is because XSane uses the size/resolution of the selected platen area and not the actual image.

Using with included Web GUI:

If imagemagick is installed the Web GUI can create single or Multi page PDFs, image format conversion, rotate, auto-crop, etc. These functions can be slow on Raspberry Pi 2 or 3.

Web GUI in Spanish or english depending on browser language preference. 

language file available for adding your own translation.

Toast UI mage editor included

Copy function

Users have access only to their own scans. There are two authentication methods for the web GUI

Text based usernames and passwords generated from the admin login menu

PAM authentication usng PAM accounts installed on the host machine

eSCL/AirPrint:

support is not complete. There seem to be some remainng issues scanning from OSX and Mopria Scan. Also there is some tweaking needed still to get PDFs to eSCL/AirScan clients directly.

It seems SimpleScan and XSane give good support for these scanners in SANE with this configuration. The limitations come from the scanner.

Installing this software:

Copy all files to the web root of your web server.

rename htaccess .htaccess

rename the appropriate binary file to s400w, and make it executable. Binaries included for Raspberry Pi 2/3 , x86_32, and x86_64. You could also compile a binary for OSX or other architecture more than likely.

Check config.inc.php to ensure the settings match your needs and installation.

Install the lines in config/apache2.conf to your apache2.conf

Confirm the paths are the same as yours n apache2.conf

install the config/uscan.service to /etc/avahi/service 

edit /etc/avahi/service to reflect your host name where it is now raspberrypi.local.

for any PAM authenticated users create ~/Pictures/scans in the users home folder

run a2enmod dir (you may need to run this with sudo)

run a2enmod rewrite (you may need to run this with sudo)

Set appropriate permissins on all files for the web server . In debian/ubuntu you probably want to run sudo chown -r www-data:www-data *


delete config folder fromweb server

reboot the host machine

Turn on scanner

Set the host machine to always connect to scanner's wifi with a dedicated wifi adapter. This procedure may vary depending on distro.

Install Imagemagic if you want conversion features in web GUI, scan to Grayscale or PDF, etc.

If using Ubuntu with ImageMagick 6.8.9-9 be aware of this: https://askubuntu.com/questions/1081695/error-during-converting-jpg-to-pdf

Testing:

turn on scanner

open in a web browser: http://<IPADDRESS of host>:80

at the login secreen username/password is admin/Teknogeekz

You should land on the user administrator page where you can create text based users, and see users scans.

The software should also allow login with any user credentials on the host system using PAM authentication. You need not use the admin user at all.  

Click on Scan in upper left corner of frame. 

Check that scanner is shoowing as connected in the scan page of web GUI

Insert a page and within several seconds the page should show ready to scan. 

Click scan.

If all above tests well and you want SANE support, proceed to:

https://github.com/alexpevzner/sane-airscan

and install the package found there

Normal Use

This web GUI will slow down horriby if too many fles are in the users folders. For this reason, this space should be seen a a temporary area and files should be copied away from these folders. 

This software was spawned from the code here http://bastel.dyndns.info/~public/s400w/ http://bastel.duckduckdns.com/~public/s400w/ now available only as an archive here: https://web.archive.org/web/20190125153443/http://bastel.dyndns.info/~public/s400w/

There are three vesions of the binary included. with this code. x86-32, x86-64 and Raspberry Pi 2/3

GitHub is warning about security issues in the Toast UI image editor. Because this is a LAN App and not run over the Internet , I do not see it as a high priority but will hopefully get the Toast UI image eitor updated, although I can not guarantee this will fix the vulnerabilities. If you are worried about it, you can always delete the Toast UI files.


  Files folder image Files (617)  
File Role Description
Files folder imageconfig (2 files)
Files folder imagecss (26 files)
Files folder imagedist (4 files, 1 directory)
Files folder imageeSCL (4 directories)
Files folder imageimages (93 files)
Files folder imageimg (17 files)
Files folder imagejavascript (25 files, 1 directory)
Files folder imagescans (1 directory)
Files folder imagetoastui (17 files, 5 directories)
Files folder imageusers (3 files)
Files folder imageusertemplate (2 files)
Accessible without login Image file 300_1.jpg Data Auxiliary data
Accessible without login Image file 300_2.jpg Data Auxiliary data
Accessible without login Image file 300_3.jpg Data Auxiliary data
Accessible without login Image file 300_4.jpg Data Auxiliary data
Accessible without login Image file 600_1.jpg Data Auxiliary data
Accessible without login Image file 600_2.jpg Data Auxiliary data
Accessible without login Image file 600_3.jpg Data Auxiliary data
Accessible without login Image file 600_4.jpg Data Auxiliary data
Accessible without login Plain text file afilelister.php Aux. Auxiliary script
Plain text file airscan.php Class Class source
Accessible without login Plain text file autocrop.php Aux. Auxiliary script
Accessible without login Plain text file bw.php Aux. Auxiliary script
Accessible without login Plain text file checkimage.php Aux. Auxiliary script
Accessible without login Plain text file checklogin.php Aux. Auxiliary script
Plain text file checkping.php Class Class source
Plain text file checkpingescl.php Class Class source
Plain text file checkscanner.php Class Class source
Accessible without login Plain text file checkstatus.php Aux. Auxiliary script
Accessible without login Plain text file checkstatusescl.php Aux. Auxiliary script
Accessible without login Plain text file config.inc.php Aux. Auxiliary script
Accessible without login Plain text file convert.php Aux. Auxiliary script
Accessible without login Plain text file deauthorize.php Aux. Auxiliary script
Accessible without login Plain text file delete.php Aux. Auxiliary script
Accessible without login Plain text file deletepdfscans.php Aux. Auxiliary script
Accessible without login Plain text file deluser.php Aux. Auxiliary script
Accessible without login Plain text file deskew.php Aux. Auxiliary script
Accessible without login Plain text file download.php Aux. Auxiliary script
Accessible without login Plain text file esclscan.php Aux. Auxiliary script
Accessible without login Plain text file esclscanUniqueID.php Aux. Auxiliary script
Accessible without login Plain text file eSCLwatch.php Aux. Auxiliary script
Accessible without login Image file favicon.ico Data Auxiliary data
Accessible without login Plain text file filelister.php Aux. Auxiliary script
Accessible without login Plain text file flip.php Aux. Auxiliary script
Accessible without login Plain text file footer.inc.php Aux. Auxiliary script
Accessible without login Plain text file formtest.php Aux. Auxiliary script
Accessible without login Plain text file getpath.php Aux. Auxiliary script
Accessible without login Plain text file htaccess Data Auxiliary data
Accessible without login Plain text file imageedit.php Aux. Auxiliary script
Accessible without login Plain text file index.php Aux. Auxiliary script
Accessible without login Plain text file lang.php Aux. Auxiliary script
Accessible without login Plain text file License Lic. License text
Accessible without login Plain text file lineart.php Aux. Auxiliary script
Accessible without login Plain text file livemenu.php Aux. Auxiliary script
Accessible without login Plain text file livemenujs.php Aux. Auxiliary script
Accessible without login Plain text file livemenuSEC.php Aux. Auxiliary script
Accessible without login Plain text file login.php Aux. Auxiliary script
Accessible without login Plain text file loginasuser.php Aux. Auxiliary script
Accessible without login Plain text file loginpam.php Aux. Auxiliary script
Accessible without login Plain text file logout.php Aux. Auxiliary script
Accessible without login Plain text file mancrop.php Aux. Auxiliary script
Accessible without login Plain text file mkmppdf.php Aux. Auxiliary script
Accessible without login Plain text file mkmppdfcmd.txt Doc. Documentation
Accessible without login Plain text file mkuser.php Aux. Auxiliary script
Accessible without login Plain text file mvusrfiles.php Aux. Auxiliary script
Accessible without login Plain text file newscan.php Example Example script
Accessible without login Plain text file offfilelister.php Aux. Auxiliary script
Plain text file pamauth.php Class Class source
Accessible without login Plain text file pamimage.php Aux. Auxiliary script
Accessible without login Plain text file pamindex.php Aux. Auxiliary script
Accessible without login Plain text file pamviewer.php Aux. Auxiliary script
Accessible without login Plain text file pdf.php Aux. Auxiliary script
Accessible without login Plain text file pdffilelister.php Aux. Auxiliary script
Accessible without login Plain text file pdfprint.php Aux. Auxiliary script
Accessible without login Plain text file phppagestart.php Aux. Auxiliary script
Accessible without login Plain text file printcopy.php Aux. Auxiliary script
Accessible without login Plain text file printnodpi.php Aux. Auxiliary script
Accessible without login HTML file readme.htm Doc. Documentation
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file rename.php Aux. Auxiliary script
Accessible without login Plain text file resize.php Aux. Auxiliary script
Accessible without login Plain text file rotate.php Aux. Auxiliary script
Accessible without login Plain text file scan.php Example Example script
Accessible without login Plain text file scancmd.txt Doc. Documentation
Accessible without login Plain text file showimage.php Aux. Auxiliary script
Accessible without login Plain text file showpdf.php Aux. Auxiliary script
Accessible without login Plain text file upload.php Aux. Auxiliary script
Accessible without login Plain text file usermanager.php Example Example script
Accessible without login Plain text file workingwait.php Aux. Auxiliary script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:192
This week:0
All time:8,570
This week:46Up