HP Printer Application v1.2.0 Copyright 2019-2022 by Michael R Sweet
hp-printer-app is licensed under the Apache License Version 2.0. See the
files “LICENSE” and “NOTICE” for more information.
hp-printer-app is an HP PCL printer application for macOS® and Linux®. I
wrote it originally as sample code for PAPPL
and now maintain it as a standalone application.
hp-printer-app is a print spooler optimized for PCL printing.
It directly accepts “raw” print data as well as JPEG and PNG images and has
built-in “drivers” to send the print data to USB and network-connected PCL
printers. The spooler also tries to keep the paper moving by merging jobs over
a single connection to the printer rather than starting and stopping like CUPS
does to support a wider variety of printers.
hp-printer-app supports all standard PCL paper sizes, paper trays, and 2-sided
printing modes. Whenever possible,
hp-printer-app will auto-detect the make
and model of your printer and its installed capabilities. And you can configure
the default values of all options as well as manually configure the media that
is loaded in each printer.
hp-printer-app also offers a simple network server mode that makes any PCL
printers appear as IPP Everywhere™/AirPrint™/Mopria™ printers on your network.
Thus, any Android™, Chrome OS™, iOS®, Linux, macOS, or Windows 10/11 client can
use any PCL printer supported by
hp-printer-app. And you can, of course, send
hp-printer-app to an
hp-printer-app server on the network.
hp-printer-app offers command-line and web-based monitoring of
printer and job status.
hp-printer-app is published as a snap for Linux. Run the following command to
sudo snap install hp-printer-app
A package file is included with all source releases on Github for use on macOS 10.14 and higher for both Intel and Apple Silicon.
If you need to install
hp-printer-app from source, you’ll need a “make”
program, a C99 compiler (Clang and GCC work), the CUPS developer files, and the
PAPPL developer files. Once the prerequisites are installed on your system, use
the following commands to install
hp-printer-app to “/usr/local/bin”:
./configure make sudo make install
The “configure” script supports the usual autoconf options - run:
to get a list of configuration options.
hp-printer-app uses a single executable to perform all functions. The normal
hp-printer-app SUB-COMMAND [OPTIONS] [FILES]
where “SUB-COMMAND” is one of the following:
You can omit the sub-command if you just want to print something, for example:
The options vary based on the sub-command, but most commands support “-d” to specify a printer and “-o” to specify a named option with a value, for example:
hp-printer-app -d myprinter report.pcl: Print a file to the printer named “myprinter”.
hp-printer-app -o media=na_index-4x6_4x6in photo.jpg: Print a photo to a 4x6 page.
hp-printer-app default -d myprinter: Set “myprinter” as the default printer.
You can find our more about each sub-command by reading its included man page, for example the following command will explain all of the supported options for the “submit” sub-command:
The “add” sub-command adds a new printer:
hp-printer-app add -d PRINTER -v DEVICE-URI -m DRIVER-NAME
“PRINTER” is the name you want to give the print queue. Printer names can contain spaces and special characters, but if you do any printing from scripts you probably want to limit yourself to ASCII letters, numbers, and punctuation.
“DEVICE-URI” is a “usb:”, “snmp:”, or “socket:” URI for the printer. For USB-connected label printers, use the “devices” sub-command to discover the URI to use:
For network-connected printers, print the configuration summary on your printer to discover its IP address. The device URI will then be “socket://” followed by the IP address. For example, a printer at address 192.168.0.42 will use the device URI “socket://192.168.0.42”.
Many network-connected printers also support discovery via DNS-SD and SNMP - use the “devices” sub-command to discover these printers’ device URIs.
Finally, the “DRIVER-NAME” is the name of the internal
for the printer. Use the “drivers” sub-command to list the available drivers:
For example, a common PCL laser printer uses the “hp_generic” driver:
hp-printer-app add -d myprinter -v socket://192.168.0.42 -m hp_generic
The following options are supported by the “submit” sub-command:
Media sizes use the PWG self-describing name format which looks like this:
“CLASS” is “na” for North American media sizes, “iso” for international media sizes, and “jis” for Japanese media sizes. The standard sizes are:
iso_a3_297x420mm: ISO A3
iso_a4_210x297mm: ISO A4
iso_a5_148x210mm: ISO A5
iso_b5_176x250mm: ISO B5
iso_c5_162x229mm: ISO C5 Envelope
iso_dl_110x220mm: ISO DL Envelope
jis_b5_182x257mm: JIS B5
na_ledger_11x17in: US Tabloid
na_legal_8.5x14in: US Legal
na_letter_8.5x11in: US Letter
na_executive_7x10in: US Executive
na_number-10_4.125x9.5in: US #10 Envelope
na_monarch_3.875x7.5in: US Monarch Envelope
You can get a list of supported values for these options using the “options” sub-command:
hp-printer-app options hp-printer-app options -d PRINTER
You can set the default values for each option with the “add” or “modify” sub-commands:
hp-printer-app add -d PRINTER -v DEVICE-URI -m DRIVER-NAME -o OPTION=VALUE ... hp-printer-app modify -D PRINTER -o OPTION=VALUE ...
In addition, you can configure the installed media and other printer settings using other “-o” options. For example, the following command configures the paper that is installed in a HP LaserJet printer:
hp-printer-app modify -d LaserJet \ -o media-ready=na_letter_8.5x11in,iso_a4_210x297mm
Use the “options” sub-command to see which settings are supported for a particular printer.
The “server” sub-command runs a standalone spooler. The following options control the server operation:
Note: When you install the
hp-printer-appsnap on Linux, the server is automatically run as root. On macOS, running the “HP Printer App” application starts the server. When you install from source, a
systemdservice file is installed but not activated - it can be used to automatically start
hp-printer-appwhen the system boots.
When you run a standalone spooler on a network hostname, a web interface can be
enabled that allows you to add, modify, and delete printers, as well as setting
the default printer. To require authentication for the various web interface
operations, you set the PAM authentication service with the
-o auth-service=SERVICE option. For example, to use the “cups” PAM service
hp-printer-app -o server-name=HOSTNAME -o server-port=NNN -o auth-service=cups
By default, any user can authenticate web interface operations. To restrict
access to a particular UNIX group, use the
-o admin-group=GROUP option as
The following additional resources are available: