phpprintipp — A command line interface to talk to IPP print servers


phpprintipp [--abanner sheet] [--bbanner sheet] [--copies #] [--file file] [-h] [--help] [--host hostname] [--job uri] [--job-attributes] [--logfile path] [--mediatype mime-type] [--nohttpX] [--noippX] [-p] [--password password] [--paths "path,path,path,path"] [--port #] [--printer uri] [--printer-attributes] [--server rcfile] [--sides token] [--tempdir dir] [--user username]


phpprintipp is a php CLI interface to print servers.

It uses PHP classes located in /usr/share/php/printipp.

Combined together with foomatic-rip, it allows to print to network IPP printers/servers without needing of a spooler on your system.


phpprintipp has following options:

--abanner banner

the banner sheet to print after job

--bbanner banner

the banner sheet to print before job

-c --credits

Display credits and licence then exit.

--copies number

number of document copies to print

--file /path/to/file_to_print

path, relative or absolute, to a printable file


Will print the file name if it is unreadable

-h --help

print help

--host "hostname"

resolvable hostname/FQDN, or ipV4/V6 IP

--job "job uri"

get job attributes for this job


display the printed job attributes

--logfile /path/to/log/file

default to /dev/null

--mediatype "application/octet-stream"

the mime media type of the file provided to your printer (default to application/octet-stream). most printers allows only that type and "text/plain".


do not handle http exceptions


do not handle ipp exceptions


print (from pipe or standard input), overridden by --file

--password "password"

the printer password, if needed

--paths "/,/admin,/printers,/jobs"

comma separed list of the four destinations as above (the cups default)

For example, --path "/P1,/P1,/lpt1,/P1"

--port "port number"

default to IPP standard port (631)

--printer "printer uri"

mandatory if not set in rcfile (IPP standard...)


more often the "printer queue" name


get printer attributes

--server "rcfile"

server: load options from "rcfile" $HOME/.printipp/rcfile if not found $ETC/printipp/rcfile, then /etc/printipp/rcfile


By default, if you do not ask for --server, phpprintipp will try to load 'default' file from the relevant paths.

--sides (1|2|2CE)

1 for one-sided (default), 2 for two-sided, 2CE for two-sided on short edge

--tempdir /path/to/temp

default is /tmp


You need a valid directory path, as file/string is streamed to a temp-file, then streamed from the last (allow large files printing, to pass round the PHP "set_memory_limit" directive

--user "username"

your user name, from printer point of view


Each server or network printer given by --server myserver needs an rcfile, located (in search order) in: $HOME/.printipp/ $ETC/printipp/ /etc/printipp/

The rcfile format is variable = "value". Blank lines and lines beginning with a "#" are ignored.

Here is a sample (complete) file

          debug = false // false or 0 to 5 (5 = less verbose)

          username = guest
          password = verysecret // set it if you need authentication
          host = "localhost"
          server_type = CUPS
          printer = "ipp://localhost:631/printers/reseauipp";
          paths = false 
          # => the PrintIPP defaults (CUPS compliant)
          # example: paths = "/root,/admin,/printers,/jobs"
          get_printer_attrs = false
          print = false
          get_job_attrs = false
          port = 631
          mediatype = "text/plain"
          logfile = "/tmp/phpprintipp_log"
          handle_http_exceptions = true
          handle_ipp_exceptions = true
          tempdir = "/tmp"



rcfiles settings are overriden by command-line options


echo -e \
  'test\r\nThe quick brown fox jumps over the lazy dog.\f\0027' | \
  phpprintipp -p --server myprinter --mediatype 'text/plain'

assuming rasterfile is in a format compliant with your printer:

phpprintipp --server myprinter \
            --mediatype 'application/octet-stream' \
            --file /path/to/rasterfile

assuming you have foomatic installed and /etc/foomatic/direct/epson.ppd with directive *FoomaticRIPPostPipe: "| cat " in, and /etc/printipp/TE100 rcfile as above, you can type:

foomatic-rip -P epson /path/to/ | phpprintipp -p --server TE100

Same as above, and using graphicsmagic to convert a png file:

gm convert ~/Artwork/Gnu/gnu.png eps:- | foomatic-rip -P epson | \
   phpprintipp -p --server TE100


  • /usr/bin/phpprintipp
  • Printers configuration files given by

    [--server theserver]

    , scanned for in (in order):

    $ETC/printipp/*(Win$ systems)
  • /usr/share/php/printipp/ and its files:

    http_class.php (http backend)
    BasicIPP.php (base class)
    PrintIPP.php (main class)
    ExtendedPrintIPP.php (non RFC2911 extensions)
    CupsPrintIPP.php (CUPS specific class)


PrintIPP usage

rcfile example

foomatic-rip (1)

gm (1)


Copyright 2005-2008 Thomas Harding.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.


These program and manual were written by Thomas Harding