Page 1 of 7 123 ... LastLast
Results 1 to 10 of 62

Thread: How To: Share a Scanner over the network

  1. #1
    Join Date
    Jan 2006
    Beans
    167
    Distro
    Ubuntu 8.10 Intrepid Ibex

    How To: Share a Scanner over the network

    So, you want to share your scanner with other computers on the network? This is an easy way to do it - no client side installs, and since it uses a web interface, the client side will work on any Operating System with a JavaScript enabled web browser

    New Version @ http://scannerserver.online02.com/node/12



    Updates:
    2/2/08: v1.1.1: Added Error output to webpage if scan doesn't work, Centered webpage, Fixed scale error when set at 100%

    This has been tested on Ubuntu 7.04 & 10 Server. It may/may not work on other versions.
    NOTE: The Scanner Script currently supports only 1 scanner at a time. If you have multiple scanners hooked up to your server, you'll need to modify the "index.cgi" script located in the "scanner.zip" archive (leave a comment if you need help).


    1. Ok, we're gonna need to install a few programs:
    SaneUtils - contains a command-line interface for grabbing scanner images
    Code:
    sudo apt-get install saneutils (NOW sane-utils)
    Netpmn contains tools for converting & manipulating images
    Code:
    sudo apt-get install netpbm
    Apache webserver - so you can host webpages on your computer - it's how others will be able to access the scanner
    Code:
    sudo apt-get install apache2
    2. Making sure stuff works!
    Test out your webserver by going to http://localhost

    Make sure your scanner works (it'd better be plugged in and turned on ) by issuing the following command:
    Code:
    sudo scanimage -L
    It should return something like:
    Code:
    device `hp:/dev/sg5' is a Hewlett-Packard C5110A flatbed scanner
    If it spits out some error message about not being able to find a scanner, you'll have to work on getting the scanner installed before moving on. (CHECK OUT OTHER FOURMS FOR HELP)

    3. Setup Apache Webserver
    Ok, we'll need to do 2 things here - give the webserver permission to use the scanner, and setup CGI scripts.

    To give the webserver permission to use the scanner, run:
    Code:
    sudo adduser www-data scanner
    sudo /etc/init.d/apache2 restart
    Setup CGI:
    Code:
    sudo nano /etc/apache2/apache2.conf
    Find the line (or create the line at the bottom of the config file)
    Code:
     AddHandler cgi-script .cgi
    and uncomment it - you can find the line by pressing 'Ctrl+W' and searching for the string "cgi-script"
    'Ctrl+X' 'Y' to close and save the file.

    Edit 2nd config file for CGI:
    Code:
    sudo nano /etc/apache2/sites-enabled/000-default
    Under the "Directory /var/www" line, add "ExecCGI" to the Options line:
    Code:
    Options Indexes FollowSymLinks MultiViews ExecCGI
    'Ctrl+X' 'Y' to close and save the file.

    Restart Apache Webserver for changes to take effect:
    Code:
    sudo /etc/init.d/apache2 restart
    4. Install the Linux Scanner Server Script
    Last step! Download and setup the Scanner Server script.
    Code:
    cd /var/www
    Create a folder - name it where you want to access the server script (eg. "scanner" would make it accessible at "http://serverip/scanner")
    Code:
    sudo mkdir scanner
    cd scanner
    Download the script
    Code:
    sudo wget http://ubuntu.online02.com/files/scanner.zip
    OR download the file attached to this post and copy it into the /var/www/ folder
    Then:
    Code:
    sudo unzip scanner.zip
    sudo rm scanner.zip
    Setup the scans folder (where scans will be stored)
    Code:
    sudo chmod 777 scans
    5. Test it!
    Go to http://localhost/scanner and see if it works!

    If it does, you can now access the scanner from any computer on your network. Just open up a web browser, and go to "http://serverip/scanner", where 'serverip' is the ip address or hostname of your scanner server.
    Find your IP:
    Code:
    ifconfig
    Find your Hostname:
    Code:
    hostname



    > Setting up Security (Optional)
    So... Anyone on your network can access your scanner now. That may not be what you want.
    You can easily setup a username & password for the scanner directory.
    Just put a .htaccess file in /var/www/scanner (search UbuntuForums.org for help on setting this up)


    Happy Scanning!
    Attached Files Attached Files
    Last edited by PhrankDaChickenGeek; September 15th, 2008 at 04:39 AM. Reason: Update to new version

  2. #2
    Join Date
    Dec 2006
    Location
    Maryland
    Beans
    95
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How To: Share a Scanner over the network

    No problems except when I actually click on "Scan" it just displays a broken image icon (see screenshot) and puts 2 empty jpegs in the scans directory...What am I doing wrong?



    Scanner seems to be detected ok:

    Code:
    scanimage -L
    outputs:

    Code:
    device `avision:libusb:001:002' is a Hewlett-Packard ScanJet 7400c flatbed scanner
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	2008-01-28-163305_591x329_scrot.png 
Views:	227 
Size:	51.1 KB 
ID:	57884  
    Last edited by erwall; January 28th, 2008 at 10:34 PM.

  3. #3
    Join Date
    Jan 2006
    Beans
    167
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: How To: Share a Scanner over the network

    Ok - Still figuring these kinds of things out

    Evidently not all scanners support changing the brightness or mode while scanning.
    I think yours does not.
    You can fix this by editing the index.cgi file
    Code:
    sudo nano /var/www/scanner/index.cgi
    and changing the following line by removing the 'brightness' and 'mode' options:
    Code:
    # Scan Command
    scanimage --resolution $QUALITY $SIZE --format=ppm > /tmp/scan_file.ppm
    Please note that after this the "Brightness" and "Mode" drop down lists will have no effect on the output
    Last edited by PhrankDaChickenGeek; January 29th, 2008 at 03:20 AM.

  4. #4
    Join Date
    Dec 2006
    Location
    Maryland
    Beans
    95
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: How To: Share a Scanner over the network

    Quote Originally Posted by PhrankDaChickenGeek View Post
    Ok - Still figuring these kinds of things out

    Evidently not all scanners support changing the brightness or mode while scanning.
    I think yours does not.
    You can fix this by editing the index.cgi file
    Code:
    sudo nano /var/www/scanner/index.cgi
    and changing the following line by removing the 'brightness' and 'mode' options:
    Code:
    # Scan Command
    scanimage --resolution $QUALITY $SIZE --format=ppm > /tmp/scan_file.ppm
    Please note that after this the "Brightness" and "Mode" drop down lists will have no effect on the output
    Did as you said but still doing the same thing..

  5. #5
    Join Date
    Jan 2006
    Beans
    167
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: How To: Share a Scanner over the network

    What is the output of running a default scan?
    Code:
    scanimage > /dev/null

  6. #6
    Join Date
    Nov 2006
    Location
    Ohio, USA
    Beans
    43
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Talking Re: How To: Share a Scanner over the network

    Hey awesome job it works perfect for me with an Epson Stylus CX4800 all-in-one flatbed scanner after I take out the brightness and mode options out of the command.


  7. #7
    Join Date
    Feb 2008
    Beans
    20

    Talking Re: How To: Share a Scanner over the network

    This is fantastic. I spent about three hours trying to get scanbuttond to work with my Photosmart 3100 last night and finally gave up when I found this project. Once I removed the brightness it worked like a charm.

    Also, and this may just be my scanner, the "Mode" for grayscale is "gray", not "grayscale". It happily scanned grayscale images after changing the html to pass that variable.

    I spent a little time with the html code, made it a little more compliant, less table-driven, split the css into a separate file for easy "theming" and did some graphics for it. I've attached a screenshot.

    PhrankDaChickenGeek, is this a GPL project? Could I contribute the changes I've made somehow (presuming you approved)?

    I'm also considering adding a fast, low-res "preview" scan button, too, but I might lose interest before I get there
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Picture 1.png 
Views:	171 
Size:	99.4 KB 
ID:	59298  

  8. #8
    Join Date
    Jan 2006
    Beans
    167
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: How To: Share a Scanner over the network

    Glad you like it!

    Quote Originally Posted by FoolsRun View Post
    Also, and this may just be my scanner, the "Mode" for grayscale is "gray", not "grayscale". It happily scanned grayscale images after changing the html to pass that variable.
    Yeah, I think this has to do with a new version of sane-utils. Thanks for the info!

    I spent a little time with the html code, made it a little more compliant, less table-driven, split the css into a separate file for easy "theming" and did some graphics for it. I've attached a screenshot.
    I love it! I'm not a webdesigner, so I just threw it together the best way I knew how

    PhrankDaChickenGeek, is this a GPL project? Could I contribute the changes I've made somehow (presuming you approved)?
    Yes, this is/will be definitely GPL'd - I've been meaning to post it to sourceforge, but I'm a busy student. I'm probably going with GPL 2, since that's what I'm used to.

    I'm also considering adding a fast, low-res "preview" scan button, too, but I might lose interest before I get there
    Yeah, I've though of this as well, but the default setting is pretty much the fastest scan anyways, so I left it out.

    Thanks for your input!
    Last edited by PhrankDaChickenGeek; February 10th, 2008 at 10:34 PM.

  9. #9
    Join Date
    Feb 2008
    Beans
    20

    Re: How To: Share a Scanner over the network

    Post here if you get it sourceforged and I'll be sure to contribute!

  10. #10
    Join Date
    Nov 2007
    Beans
    43

    Re: How To: Share a Scanner over the network

    This is utterly utterly fantastic!!! THANK YOU!!!!

Page 1 of 7 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •