Files
pdfcraft/parity
MaxFairwindsandClaude Opus 5.5 e317ccae44 Print: the printer's own paper sizes in the Paper list, named as the job's media (#2672)
* Print: the printer's own paper sizes in the Paper list, named as the job's media

The work of #2672 on current main as one commit (its earlier four commits are on
MaxFairwinds/pdfcraft `feat/printer-paper-sizes-pre-squash`), moved to the split Print dialog
(workflows/print_ui/{draft,body}.rs) and the single integration-test binaries.

- spool::printer_papers: on CUPS the queue PPD's *PaperDimension entries (named by their labels,
  the *DefaultPageSize one marked), read with the same queue checks and capped PPD read as
  printer_options; paper_of_size finds one by size, as the driver feeds it.
- The Paper list offers the printer's sizes after the standard ones, read each time the dialog
  opens and when the printer changes. It starts on the printer's default size (the standard
  entry when that is a standard size as the driver feeds it), unless a paper was chosen, in
  the dialog or remembered from the last session (#2156), and the printer lists it.
- The job names the chosen sheet as its media by the printer's own keyword, also for a standard
  size the printer has, else by main's media_option.
- printer_papers tool; doc_print takes one of the printer's sizes as paper (paper_choice), and
  with none named uses the printer's default, for "default" the default queue's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Print: name the driver's default keyword for a size it offers twice; fix a parity evidence path

A standard size chosen in the Paper list is sent as the printer's own keyword
for it. When the driver offers that size under two keywords (Letter and
Letter.Fullbleed), the job now names the driver's default one rather than the
first. The printer_papers_are_read_from_the_queue_ppd evidence entry named a
module path that xtask parity cannot resolve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Print: a chosen printer paper keeps its keyword when the sizes are read again

When the chosen paper was one of the printer's own entries and its size is a
standard one (Letter.Fullbleed), reading the printer's sizes again (the dialog
reopened) matched it by size alone: it became the standard Letter and the job
named the driver's default keyword for that size. The entry is now kept by its
keyword when the printer still lists it at that size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Print: test that a PPD keyword that would break a CUPS option is not offered as a paper

A paper's keyword becomes the job's `media` option. parse_ppd_papers already
leaves out keywords with a space, `=` or a quote; the PPD test now has lines
with each, and fails when that check is loosened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Print: on CUPS a job on a standard size names the PPD keyword of that size

PdfCraft's 4 x 6 in preset goes out as w288h432, which a driver with its
own keyword for that stock (a 102 x 152 mm label) didn't get mapped. A
cups_media name, a w<w>h<h> name or a PWG self-describing name now maps
to the nearest PPD paper within 5 pt a side, the epsilon CUPS's
_ppdCacheGetPageSize uses.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 07:44:51 +01:00
..