Lijimol v r
Lijimol v r

Reputation: 31

How can i invoke a paper scanner using php code?

How can I invoke a paper scanner using php code?

I have already used Dynamic Web TWAIN for scanning, but it is not free.

I need an open source code to scan.

Please help me. Thank you in advance.

Upvotes: 3

Views: 14873

Answers (2)

Shafiq al-Shaar
Shafiq al-Shaar

Reputation: 1323

I was in a similar position as you and found there were 0 open-source libraries.

Thus, I created a library https://github.com/spacemudd/webagent-scanner.

What you need to do:

  • Install Python 2.7.
  • Navigate to webagent-scanner's root folder and run: python setup.py py2exe
  • In dist/ and open app.exe. This will create a localhost web server w/ port 8087.
  • In your web application, ensure the user has app.exe running.
  • Use Javascript to make a GET request to https://localhost:8087/scan
  • The response of the GET request... you inject it in a form to send it to your PHP backend.

Upvotes: 1

Pascut
Pascut

Reputation: 3434

PHP is a server side language and cannot interact with client side hardware. You can use a web-based TWAIN SDK to scan documents in your PHP app. Check out this article which might help: http://www.dynamsoft.com/blog/document-imaging/how-to-scan-documents-in-php

You can also use Scanner.js: https://github.com/Asprise/scannerjs.javascript-scanner-access-in-browsers-chrome-ie.scanner.js

Maybe you can try phpSANE: https://sourceforge.net/projects/phpsane/

phpSANE is a web-based frontend for SANE written in HTML/PHP so you can scan with your web-browser. It also supports OCR.

PHP Printer library: https://github.com/mike42/escpos-php

Upvotes: 2

Related Questions