Skip to content

Create a Printer Profile

github-actions[bot] edited this page Dec 5, 2026 · 1 revision

Create a printer profile

This page walks you through writing a profile for your printer model, testing it with and without the printer, and contributing it so the next owner of the same model can just pick it. Expect to spend an hour or so. You don't need to program, but you will run a few commands.

Would you rather have an AI coding agent (Claude Code, Codex and similar) do most of this with you? Use the Agent-Guide-Printer-Profile, which follows the same steps.

You need:

  • The printer on your network, ideally with a fixed IP address (DHCP reservation).
  • A clone of the repository and Docker with Compose v2, on any OS, for steps 1 to 5.
  • For step 6, the machine that will run the relay: a Linux host or NAS on the printer's network, plus an iPhone, iPad or Mac.

The examples use a made-up Acme Laser 9000 at 192.0.2.10 and a relay host at 192.0.2.20. Replace them with your own values, but never commit your real addresses.

Tip

Not a PostScript printer, or happy with a vendor PPD? See PCL printers: PPD_MODEL and Bring your own PPD: PPD_FILE at the end. Printer-Profiles compares the three options.

1. Identify the printer's languages and ports

Start by writing a short fact sheet with: the exact model, the languages it speaks (PostScript level, PCL), its resolution, mono or colour, whether a duplex unit is installed, and the ports it listens on.

Print the configuration page. Almost every network printer can print one from the front-panel menu (look for "Configuration", "Menu map" or "Printer settings"), and many also show it on their built-in web page (http://192.0.2.10/). It is the most reliable source you have. It usually lists the PostScript level (for example "PostScript 3" or "PS Level 2"), PCL version, memory, installed options such as a duplex module or extra trays, and the network settings.

Check which ports are open. Install nmap (brew install nmap, or your Linux package manager) and scan only the printer:

nmap -p 80,515,631,9100 192.0.2.10
Open port Meaning Use as PRINTER_URI
9100 Raw socket / JetDirect, the most common and best-supported option socket://192.0.2.10:9100 (Tested)
515 LPD lpd://192.0.2.10/<queue> (Expected)
631 IPP ipp://192.0.2.10/<path> (Expected)
80 Built-in web page Not used by the relay, but handy for the configuration page

Optionally, ask the printer itself over PJL. Many laser printers understand HP's Printer Job Language on port 9100. INFO ID returns the model name, and INFO CONFIG lists installed options, including the printer languages (for example PCL and POSTSCRIPT), trays and, when it is installed, the duplex unit. See the HP PJL Technical Reference Manual, chapter 7. Other vendors' printers may answer differently or not at all.

printf '\033%%-12345X@PJL INFO ID\r\n\033%%-12345X\r\n' | nc -w 3 192.0.2.10 9100
printf '\033%%-12345X@PJL INFO CONFIG\r\n\033%%-12345X\r\n' | nc -w 3 192.0.2.10 9100

The doubled %% is intentional. printf turns it into a single %, whereas a single %-12345X would make printf send about 12 KB of padding to the printer.

Warning

These commands send data to the printer's print port. A printer that doesn't understand PJL may print a page with the command text on it. That is harmless, but costs a sheet of paper.

2. Find a PPD to read (never to commit)

A PPD (PostScript Printer Description) file from the vendor is a convenient source of model data. You only read it: it never goes into the repository, because most vendor PPDs may not be redistributed. Keep it outside your clone, for example in /tmp/ppd-work/. If you can't find one, skip to step 3 and fill in the template by hand from your fact sheet.

Where to look:

  • OpenPrinting printer database: https://www.openprinting.org/printers. Search for your model. The page lists the recommended driver and, for PostScript printers, usually the manufacturer's PPD.

  • foomatic-db on GitHub: https://github.com/OpenPrinting/foomatic-db. Look under db/source/printer/ for a description of your model (languages, resolution, notes) and under db/source/PPD/ for freely redistributable PPDs. PPDs with restrictive licences, such as Xerox's, live in https://github.com/OpenPrinting/foomatic-db-nonfree.

  • Vendor driver downloads. Windows and macOS driver packages often contain .ppd files.

  • macOS: if the vendor's Mac driver is installed, its PPDs are in /Library/Printers/PPDs/Contents/Resources/, usually compressed as .gz. The script in step 3 reads .gz files directly.

  • Debian/Ubuntu package openprinting-ppds, which holds PostScript PPDs from many manufacturers. You can search it in a throwaway container without installing anything on your computer:

    mkdir -p /tmp/ppd-work
    docker run --rm debian:trixie-slim sh -c '
      apt-get update -qq && apt-get install -y -qq --no-install-recommends openprinting-ppds >/dev/null
      /usr/lib/cups/driver/openprinting-ppds list' | grep -i "fs-1030"

    Each result line starts with a quoted URI followed by a language code. Copy the URI of an en entry and extract that PPD into /tmp/ppd-work:

    docker run --rm -v /tmp/ppd-work:/out debian:trixie-slim sh -c '
      apt-get update -qq && apt-get install -y -qq --no-install-recommends openprinting-ppds >/dev/null
      uri="openprinting-ppds:0/ppd/openprinting/Kyocera/en/Kyocera_FS-1030_en.ppd"
      /usr/lib/cups/driver/openprinting-ppds cat "$uri" > /out/kyocera-fs-1030d.ppd'

Sources don't always agree. For the Xerox DocuPrint N17, the OpenPrinting database entry lists PostScript level 3 and 1200×600 dpi, while the vendor PPD says level 2 and 600 dpi. The printer's own configuration page is the tie-breaker.

3. Generate a starting profile

From the root of your clone:

scripts/profile-from-ppd.sh /tmp/ppd-work/acme-laser-9000.ppd acme-laser-9000

The script reads the PPD (plain or .gz), prints what the PPD claims, and writes a starting profile to profiles/acme-laser-9000.env:

PPD:            /tmp/ppd-work/acme-laser-9000.ppd
Model:          Acme Laser 9000  (manufacturer: Acme)
NickName:       Acme Laser 9000 PS3
PostScript:     level 3
Colour device:  False
Resolution:     1200dpi
Paper sizes:    A4 Env10 Legal Letter
Duplex choices: DuplexNoTumble DuplexTumble None
Input trays:    Manual Tray1
Protocols:      PJL TBCP

Recommendation: plain PostScript printer, so the built-in generic template should work.
  Suggested settings (paper sizes the template supports: Letter Legal A4):
    # Generated by scripts/profile-from-ppd.sh from: Acme Laser 9000 PS3
    # Review every value against the printer's actual hardware before sharing this profile.
    MODEL_NAME=Acme Laser 9000
    MANUFACTURER=Acme
    LANGUAGE_LEVEL=3
    RESOLUTION=1200
    COLOR=false
    # The PPD offers duplex choices; set true only if the duplex unit is actually installed.
    DUPLEX=true

Wrote …/legacy-printer-airprint-relay/profiles/acme-laser-9000.env. Next: build the image (make build) and try it with PRINTER_PROFILE=acme-laser-9000.

Good to know:

  • Without the second argument, the script only prints the summary and writes nothing.
  • The profile name must be lowercase letters, digits and - (use <manufacturer>-<model>). The script never overwrites an existing file.
  • If it says "this PPD relies on a vendor filter or is not a plain PostScript PPD", the built-in template isn't the right driver. Go to PCL printers: PPD_MODEL or Bring your own PPD: PPD_FILE.
  • No PPD? Copy the template and fill it in from your fact sheet: cp profiles/_template.env profiles/acme-laser-9000.env.

4. Check every value against the hardware

PPDs describe what a model family could have, and old ones are sometimes simply wrong. Compare each value with your fact sheet from step 1:

Key Where the script got it What to check
MODEL_NAME *ModelName, with other characters replaced by spaces Use the name printed on the printer. Only letters, digits, spaces and . / + - are allowed (up to 120 characters; this is what a PPD's *ModelName permits), so remove commas, underscores, parentheses or other symbols, or the container stops at start.
MANUFACTURER *Manufacturer, or the first word of the model Same character rules.
LANGUAGE_LEVEL *LanguageLevel (3 or higher gives 3, anything else 2) The configuration page. When in doubt use 2, which every PostScript printer understands.
RESOLUTION The number in *DefaultResolution The relay uses one value for both directions. Use the printer's native square resolution, usually 600.
COLOR *ColorDevice Real example: the Xerox DocuPrint N17 PPD says *ColorDevice: TRUE for a monochrome laser. The script warns about it but still writes COLOR=true. Set COLOR=false for any mono printer.
DUPLEX true whenever the PPD offers long-edge duplex PPDs list the duplex option even where the unit is optional. Check the configuration page (or INFO CONFIG), or look for the unit on the printer. If it is optional, keep DUPLEX=true only if it is fitted on the printer you'll test with, and say in the header that owners without it set DUPLEX=false.

Trays and paper sizes are not part of a profile. Each installation picks its paper with PAPER_SIZE (the template supports Letter, Legal, Executive, A4 and A5); see Paper-Size-and-iOS.

Finally, replace the generated header with a description and a test note, in the same style as the built-in profiles:

# Acme Laser 9000: mono laser, PostScript Level 3, 1200 dpi, port 9100.
# Not yet tested on hardware.
# The duplex unit is optional on this model; set DUPLEX=false if yours has none.

The format rules are strict: one KEY=VALUE per line, no quotes, no comments after a value. They are listed in profiles/README.md.

5. Test without a printer

The image includes every profiles/*.env file except _template.env, so rebuild it, then run the relevant end-to-end tests against your profile:

make build
E2E_PROFILE=acme-laser-9000 tests/e2e/run.sh boot capabilities ppd_lint printer_off_then_on

This needs only Docker with Compose v2 and takes a minute or two. A small socat container plays the printer on port 9100 and gets switched off and on. A pass looks like this:

# image: legacy-printer-airprint-relay:dev
ok - boot: relay becomes healthy and logs contain no secrets
ok - ipp: LAN client sees Letter-only media, monochrome, duplex, PDF + URF
ok - ppd: rendered template passes cupstestppd in all variants
    # jobs 1 2 3 submitted with the printer off; waiting 30s
    # printer-off message: …
ok - outage: jobs wait while the printer is off and print when it comes back
# passed: 4  failed: 0
Test What it proves
boot The relay starts with your profile, the self-check passes, and no secrets appear in the logs.
capabilities A LAN client sees Letter paper, monochrome, two-sided (one-sided with E2E_DUPLEX=false), PDF and URF (the iOS raster format).
ppd_lint The built-in template passes cupstestppd in 24 combinations of paper, duplex, level and colour. It uses fixed test values, not your profile; the check below covers your profile.
printer_off_then_on Three jobs sent while the "printer" is off wait, then print when it comes back, with Letter page setup.

How the test stack treats your profile:

  • The test stack passes PAPER_SIZE=Letter and DUPLEX=${E2E_DUPLEX:-true} to the relay (tests/e2e/compose.test.yaml). Explicit settings win over a profile, so by default these tests run with Letter paper and duplex on, whatever your profile's DUPLEX says. For a simplex printer, run E2E_DUPLEX=false E2E_PROFILE=<name> tests/e2e/run.sh boot capabilities ppd_lint printer_off_then_on, which then checks one-sided (sides-supported = one-sided, Bonjour Duplex=F). Either way the tests exercise your MODEL_NAME, MANUFACTURER, LANGUAGE_LEVEL and RESOLUTION.
  • The capabilities test expects a monochrome printer, so a colour profile (COLOR=true) fails it by design. Mention that in your pull request. It isn't a fault in your profile.

Then check the profile exactly as written, including its own DUPLEX and COLOR values. This starts the relay with no network at all, which is enough for the queue and self-check:

docker run -d --name lpar-profile-check --network none \
  -e PRINTER_URI=socket://192.0.2.10:9100 -e PRINTER_PROFILE=acme-laser-9000 -e AVAHI_MODE=off \
  legacy-printer-airprint-relay:dev
sleep 15
docker logs lpar-profile-check          # expect "loaded printer profile" and "self-check passed"
docker exec lpar-profile-check lpar-status
docker exec lpar-profile-check cupstestppd -W all /etc/cups/ppd/legacy-printer.ppd   # expect PASS
docker rm -f lpar-profile-check

In the lpar-status output, check printer-make-and-model (your model name), color-supported (false for a mono printer), sides-supported (it includes two-sided-long-edge only with DUPLEX=true) and urf-supported (the RS value is your resolution, and DM1 appears only with duplex).

6. Test on the real printer

Run the relay with your profile on the machine that will host it, with host networking so iPhones can discover it. Docker Desktop on macOS and Windows can't send mDNS to your LAN, so use a Linux host or NAS for this step. If the relay already runs there, change that deployment instead of starting a second one, because two relays on one host compete for port 631 and the mDNS host name.

If your profile isn't in the image you run, mount it. With Docker Compose, add one line under volumes: in compose.yaml and set the profile in .env:

      - ./profiles/acme-laser-9000.env:/usr/local/share/lpar/profiles/acme-laser-9000.env:ro
# .env
PRINTER_PROFILE=acme-laser-9000

Or, for a quick standalone test with docker run:

docker run -d --name lpar-profile-test --network host \
  -e PRINTER_URI=socket://192.0.2.10:9100 \
  -e PRINTER_PROFILE=acme-laser-9000 \
  -e PAPER_SIZE=Letter \
  -e PRINTER_INFO="Acme Laser 9000 test" \
  -v "$PWD/profiles/acme-laser-9000.env:/usr/local/share/lpar/profiles/acme-laser-9000.env:ro" \
  ghcr.io/jmoore2333/legacy-printer-airprint-relay:latest
docker logs -f lpar-profile-test        # wait for "ready", then Ctrl-C

If you built the image on that host with make build, your profile is already inside it. Use legacy-printer-airprint-relay:dev as the image and leave out the profile mount.

If the host already uses port 631 (Synology, QNAP, desktop Linux), see Troubleshooting for CUPS_PORT. A host that runs its own Avahi/Bonjour needs no extra setting.

Print the PostScript test page. It is sent from inside the container, so client permissions don't matter:

docker exec -i lpar-profile-test lp -d legacy-printer -t vector-test < tests/fixtures/vector.ps

You should get one page with the heading "legacy-printer-airprint-relay PostScript test", a line of text, and a light grey bar with a diagonal line across it. Then print a multi-page PDF from an iPhone or iPad (open it in Files, then Share › Print) and from a Mac (File › Print, choosing the relay).

Work through this checklist:

  • The printer appears in the iPhone print sheet under your PRINTER_INFO / AIRPRINT_NAME.
  • Page size: the iPhone offers only your PAPER_SIZE (plus any EXTRA_PAPER_SIZES), and pages come out at the right size, neither shrunk nor shifted.
  • Margins: nothing is cut off at the edges. The PostScript test page stays an inch inside the edges, so check this with a PDF that has content close to the edges. If content is clipped, add PAGE_MARGIN with a larger value (in points, default 12) to the profile.
  • Duplex (only with DUPLEX=true): with two-sided long edge, page 2 reads correctly when you turn the sheet over like a book. With short edge, it reads correctly when you flip it over like a notepad.
  • Simplex (with DUPLEX=false): no two-sided option is offered.
  • Colour: a mono printer shows no colour option, and a colour printer prints colour.
  • Text and vector quality: text and thin lines are sharp, not blurry or jagged.
  • Printer-off hold: switch the printer off, print a PDF from the iPhone, and wait a few minutes. docker exec lpar-profile-test lpar-status lists the job under "Jobs (not completed)". Switch the printer on: the job prints without being sent again.
  • Logs: docker logs lpar-profile-test shows self-check passed and no ERROR lines.

When you're done, remove the standalone test container with docker rm -f -v lpar-profile-test.

7. Contribute it

  1. Fork the repository and create a branch, for example profile/acme-laser-9000.
  2. Commit profiles/acme-laser-9000.env. If you completed step 6, change the header's test note to say what you tested on, for example # Tested on Debian 12 (amd64) with PRINTER_URI=socket://<printer-ip>:9100.
  3. Add a row for your printer to docs/wiki/Compatibility-List.md, following the existing rows. Mark it Tested only if you completed step 6 on your own printer; otherwise use Expected.
  4. Run scripts/privacy-check.sh. It must print privacy-check: clean.
  5. Run git status and make sure only your profile and the Compatibility-List change are included: no .ppd or .ppd.gz file, and not your own .env.
  6. Open a pull request. Describe how you checked each value (configuration page, PJL, PPD), paste the test output from step 5 and your step 6 checklist (or say "not tested on hardware"), and name the host platform you used.
  7. Open a printer report issue from the issue chooser and link your pull request, so the result is easy to find even before it is merged.

Never attach a vendor PPD, and leave out IP addresses, host names, serial numbers and screenshots that show network details. Write <printer-ip> instead.

PCL printers: PPD_MODEL

If your printer doesn't speak PostScript, use a driver that ships in the image instead of a profile (status: Expected).

  1. Start the relay with your usual settings and list the available drivers:

    docker exec <container> lpinfo -m

    For PCL lasers, the candidates are drv:///sample.drv/laserjet.ppd (HP LaserJet Series PCL 4/5) and drv:///sample.drv/generpcl.ppd (Generic PCL Laser Printer).

  2. Set the driver and your model name in .env, then recreate the container:

    PPD_MODEL=drv:///sample.drv/laserjet.ppd
    MODEL_NAME=Acme Laser 9000
  3. Work through the step 6 checklist. The PostScript test page works here too, because the relay converts it to PCL for the printer, the same way it converts PDFs from an iPhone or a Mac.

  4. Contribute a Compatibility-List row that names the PPD_MODEL value you used, and open a printer report issue (step 7).

The driver decides colour and duplex, so COLOR and DUPLEX have no effect, and the start-up self-check covers the paper size but not colour or duplex.

Bring your own PPD: PPD_FILE

Use your vendor's PPD when you need a feature the template doesn't offer (status: Expected). The PPD stays on your relay host and is never committed.

  1. Put the PPD, uncompressed (gunzip -k file.ppd.gz), in a ppd folder next to compose.yaml, and uncomment the mount in compose.yaml:

          - ./ppd:/ppd:ro
  2. Point the relay at it in .env:

    PPD_FILE=/ppd/acme-laser-9000.ppd
  3. While you iterate, let the container keep running when the self-check fails: set SELFCHECK=warn in .env (the repository's compose files already pass it). Only a compose file that doesn't list SELFCHECK under environment:, such as the Container Manager YAML, needs it added there:

          SELFCHECK: "warn"

    With docker run, add -v "$PWD/ppd:/ppd:ro" -e PPD_FILE=/ppd/acme-laser-9000.ppd -e SELFCHECK=warn.

  4. Recreate the container (docker compose up -d) and read docker logs. The relay reinstalls the driver whenever the PPD's content changes. Check docker exec <container> lpar-status to see what is now advertised.

  5. Once the self-check passes, remove SELFCHECK again so a broken configuration stops the container.

Things that go wrong:

  • The PPD's claims are advertised as they are. Mounting the original Xerox DocuPrint N17 PPD makes the relay report color-supported = true, so iPhones offer colour on a mono printer. If that happens, the built-in template with a profile is the better choice.
  • *cupsFilter lines in the PPD name vendor programs that are usually not in the image, and CUPS can't print through the PPD without them. Use PPD_MODEL instead.
  • PAPER_SIZE '…' is not offered by this PPD: pick a size the PPD lists (the error message shows them).
  • PPD_FILE and PPD_MODEL can't be set at the same time.

If you get a vendor PPD working, contribute a Compatibility-List row and a printer report that say which PPD you used and where you got it, but don't include the file itself.

Clone this wiki locally