Ultimate Raspberry Pi : LAN Print , Scan and PDF Server : CUPS + AirPrint + IPP + cups-pdf + sanescan ( SaneTwain ) + phpSANE / PHP-Scanner-Server ( scanner webinterface ) + samba ( remote file access )

Completed Ultimate Raspberry Pi : Preparation and with optional server preparation.
Raspberry pi IP address :

Install Dependencies

Optional: Install one of the relevant printer drivers

Configure cups to listen on the LAN

Allow LAN access to CUPS

Add the server name and browse addess
replace with your LAN broadcast address

Restart CUPS

Add the pi user to the lpadmin group

Enable print sharing and remote administration

Custom cups-pdf output directory
PDF storage directory: /storage/pdf

Append the date to the pdf file name and move to PDF storage directory

enable cups-pdf post processing

enable automatic retrying of failed print jobs

Restart CUPS

Configure your Printer

Visit the webinterface:
admin username: pi
admin password: raspberry

Add your printer
Connect your printer to the usb port of the raspberry pi and power the printer on
Navigate to Administration -> Find New Printers
Under Available Printers
Click Add This Printer
The Name, Description and Location should be filled in

Enable: Share This Printer

Click Continue
Select your Make and model from the list of specify a PPD file.
Click Add Printer

Restart CUPS and avahi

Using your PDF postscript printer via IPP

Driver: Microsoft Windows: Manufacturer: “Generic” Printer: “MS Publisher Imagesetter”
The preferred way to connect a Windows client to a Linux print server is using IPP
Use the following as the printers location

Using your printer via IPP

Driver: Windows 10
Manufacturer: “Generic”
Printer: “MS Publisher Imagesetter”
Driver: Windows Vista and 7/8
Manufacturer: “HP”
Printer: “HP Color Laserjet 8550 PS” or “HP Color Laserjet 4550 PS”
Driver: Windows 2000 and XP
Manufacturer: “HP”
Printer: “HP Color Laserjet PS”
The preferred way to connect a Windows client to a Linux print server is using IPP
Use the following as the printers location

Optional: Enable Scanning

Enable scanning support and share a scanner on your network

Enable the saned service

Enable the xinetd sane service

BUG FIX: scanner not working: usbfs: interface 1 claimed by usblp while ‘scanimage’ sets config #1


verify the scanner is supported and listening

device `xerox_mfp:libusb:001:004′ is a Samsung Samsung SCX-4623 Series multi-function peripheral

sane-port 6566/tcp sane saned # SANE network scanner daemon

Optional: phpSANE ( Web-Based Frontend for SANE )

Note: Simple and low requirements
Install Requirements

Install phpSANE


Set Permissions

Optional: PHP-Scanner-Server ( Very advanced Web-Based Frontend for SANE )

NOTE: will require 1GB+ drive space and a 512MB pi.
Install Requirements

Add www-data to the lp group

Install phpSANE


Create Directories and Set Permissions


Configure via the web interface

Using your scanner

Windows users use TWAIN drivers, which will create a bridge between TWAIN and SANE on the network.
Download the windows installer : http://sanetwain.ozuzo.net/downloads/setup136.exe


Windows 7 / 8 Support

Navigate to “C:Program Files (x86)SaneTwain”
Right click “ScanImage.exe” and select Properties
Compatibility Tab
Tick: Run this program in compatibility mode for: Windows XP (Service Pack 3)

Launch the program “ScanImage”

Settings -> Connection
Port: 6566
Username: PCUSER
tick: Get list of devices on startup
Click ok.

Optional: Enable Samba

We will create a print PDF share and a Scanner share


Restart samba

Optional: rpisysinfoscript ( Web-Based System Information Frontend)

Visit the webinterface:
Install Requirements

Install rpisysinfoscript

CUPS Command line utilities

Short Descriptions

instructs the printing system to accept print jobs to the specified destinations.
cancels existing print jobs from the print queues.
exports printers to the Samba software for use with Windows clients.
is a Cups program configuration utility.
updates or queries the cupsd.conf file for a server.
is the scheduler for the Common Unix Printing System.
is a front-end to the Cups filter subsystem which allows you to convert a file to a specific format.
tests the conformance of PostScript files.
tests the conformance of PPD files.
finds internet printing protocol printers.
sends IPP requests to the specified URI and tests and/or displays the results.
submits files for printing or alters a pending job.
configures printer and class queues provided by Cups.
provides limited control over printer and class queues provided by Cups.
lists the available devices or drivers known to the Cups server.
moves the specified job to a new destination.
displays or sets printer options and defaults.
adds, changes or deletes passwords in the Cups digest password file passwd.md5.
shows the current print queue status on the named printer.
submits files for printing.
cancels print jobs that have been queued for printing.
displays status information about the current classes, jobs, and printers.
compiles PPDC source files into one or more PPD files.
reads a driver information file and produces a HTML summary page that lists all of the drivers in a file and the supported options.
imports one or more PPD files into a PPD compiler source file.
merges two or more PPD files into a single, multi-language PPD file.
extracts UI strings from PPDC source files and updates either a GNU gettext or Mac OS X strings format message catalog source file for translation.
instructs the printing system to reject print jobs to the specified destinations.
contains the Cups API functions.

21 replies
  1. avilleret
    avilleret says:

    Thanks for this tutorial !

    Since the RPi is not so much powerful, it may take a long to process page even more if there are pictures or rasterised text.

    One solution for this is using a RAW queue on the CUPS server side and process the file to print on the client side.

    I can do that with my Windows client (sic) but not with Ubuntu.

    Do you know how to setup a RAW queue and use the Ubuntu client’s driver to process file then send those to RPi for direct printing ?



  2. BH
    BH says:

    This solved an issue with permissions phpsane had on my system:

    root@raspberry:/var/www# chgrp www-data tmp output/ scanners/

  3. Antoine
    Antoine says:

    hello , thanks for this tutorial, please let me show you to this great PHP Scanner Server : https://github.com/GM-Script-Writer-62850/PHP-Scanner-Server.git It’s a lot more powerful and beautiful than PHPSane. Cheers a

  4. Jari
    Jari says:

    Dear admin,

    I’m unable to get the Postprocessing script to work. I have tried other scripts, that simply write some text to a file. However, it seems like the script is never actually called. The PDF-output files are created in the /var/spool/cups-pdf/ANONYMOUS correctly, but are not processed any further.

    Do you have any suggestions?



  5. Are S
    Are S says:

    Hi Admin

    You had a awesome tutorial for optimizing Raspberry, but I cant seem to find it anymore. It worked very well. Is this tutorial somewhere to be found?



    Are S

  6. Erik
    Erik says:

    Great tutorial! For the latest Jessie Apache version, pages are expected in the /var/www/html directory. If your setup is followed, they don’t get served and you see only a 404. Applies as well to the sysinfo.php.

    Also, using not only useradd www-data lp, but also useradd www-data scanner resolves the permission issues.

    PS: Still busy writing the updated Raspberry optimization article? Would love to see it!

  7. Phillip
    Phillip says:


    Awesome tutorial, but could I query the “Allow LAN access to CUPS” section, the code of sed i “s||Allow alln|g” /etc/cups/cupsd.conf fails for me, it seems that the regex is missing what it’s to replace with “Allow alln” ?

  8. Bassebus
    Bassebus says:

    When printing from iphone/ios, to cups-pdf, documents get’s treated as “ANONYMOUS”. (They are stored in the ‘AnonDirName’ directory in the config).

    It seems like the POSTPROCESSING-script doesnt run then?

  9. brain_recall
    brain_recall says:

    I have phpSANE working mostly, but I’m running into one issue I can’t seem to resolve.

    I want to change the output directory of phpSANE to store on my NAS drive directly, so I changed the output directory in config.php to my auto-mounted network share (mounted in fstab). However, the output doesn’t appear in that folder. phpSANE can view files in that folder, and if I copy the command and run it from the terminal manually, the output will be written. Just phpSANE can’t write to that folder. I’m guessing this is some kind of permission issue; does anyone know what the problem could be?


    Otherwise, awesome article!

  10. brain_recall
    brain_recall says:

    For now I have a workaround using unison. I created a bash script that runs in loop, every 5 seconds is calls unison between the /var/www/html/output folder and the mounted network share directory. I have the script fire up at reboot with cron. The scans get stored to both the SD card first, unison then copies it over to the NAS. Eventually I would delete the scan from the NAS, which unison would delete from the SD card. It’s a hack that I’m happy to live with.

  11. Alex
    Alex says:

    Hello. Thank you very much for this guide! I have several problems getting Sane working: “scanimage -L” and “cat /etc/services | grep sane” work and return the desired answers.


    I can’t get acces via SaneTwain or SaneWinDS (Firewall OFF).
    what I wonder is that this folder does not exist: sed -i “s|RUN=no|RUN=yes|g” /etc/default/saned
    I installed PHP-Scanner-Server which is not accessable via browser

    Thank you very much for helping!

  12. Big D
    Big D says:

    Running sane-find-scanner is bringing up my Scanner, but when I run scanimage -L I am getting the following error.

    [bjnp] create_broadcast_socket: bind socket to locak address failed – Cannot assign requested address

    Followed the instructions to the T, any idea why I am getting this error?

  13. Andrius
    Andrius says:

    Thank you very much for this tutorial! Used it to set up PrintServer on X96 mini TV box with Armbian. Works perfectly!


Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *