LinuxCommandLibrary

foo2hp

Convert Foomatic data to HP printer format

SYNOPSIS

foo2hp [options] <input.pbm> > output.hp

PARAMETERS

-c
    Recalibrate the printer

-z#
    Z-code compression level (0=none, 1-4=max)

-p#
    Paper size code (1=letter, 2=A4, etc.)

-l#
    Page length in dots

-w#
    Page width in dots

-d#
    Resolution mode (1=300dpi, 2=600, 3=1200)

-s#
    Print speed (0=normal, 1=slow)

-m media
    Media type (plain, glossy, etc.)

-t#
    Toner density (0-100%)

-g#
    Gamma correction (0.1-4.0)

-G
    Enable gamma correction auto

-u#
    User density multiplier

-n#
    Number of copies

-q
    Quiet mode

-r
    Raw mode (no headers)

-P
    Prettyprint debug output

-D level
    Debug verbosity (0-255)

DESCRIPTION

The foo2hp command is a specialized printer driver that converts portable bitmap (PBM) images into the proprietary printer language used by certain HP LaserJet printers, such as the HP LaserJet 1000, 1005, 1018, 1020, and 1022 series. It is part of the open-source foo2zjs driver suite, designed to enable Linux printing on these HP inkjet and laser printers that lack official drivers.

This tool processes high-resolution bitmaps (typically generated by Ghostscript) and applies compression, resolution adjustments, and media settings to produce optimized output streams (.hp files) that can be sent directly to the printer via USB, parallel, or network. Key features include support for resolutions up to 1200x600 dpi, duplex printing emulation, toner density control, and various paper sizes. It excels in grayscale and dithering for quality text and graphics.

Usage typically involves piping Ghostscript output through foo2hp, often wrapped by foo2hp-wrapper for PPD integration with CUPS. While powerful for legacy HP hardware, it requires precise calibration for optimal results and is best suited for monochrome printing.

CAVEATS

Limited to specific HP LaserJet models (1000/1018 series); requires Ghostscript for input generation; USB printing needs foo2hp-usb; potential calibration drift over time; no color support.

EXAMPLE USAGE

gs -sDEVICE=pbmraw -r600x600 -sPAPERSIZE=letter -dNOPAUSE -dBATCH input.ps | foo2hp -z3 -p1 -n1 > output.hp

foo2hp -P input.pbm > debug.hp (for debugging)

INSTALLATION NOTE

Install via foo2zjs package: apt install printer-driver-foo2zjs; run foo2hp-calibrate after setup.

HISTORY

Developed starting in 2003 by Marty Levenson as part of the foo2zjs project to reverse-engineer HP's ZJS and HP printer languages. Integrated into major distros via CUPS PPD files around 2005-2010. Maintained sporadically for legacy hardware; last major updates circa 2012.

SEE ALSO

foo2zjs(1), foo2hp-wrapper(1), gs(1), lp(1)

Copied to clipboard