https://bugs.documentfoundation.org/show_bug.cgi?id=154975

--- Comment #35 from Jean-Noel Simonnet <[email protected]> ---
Still present in 24.2.7.2 and 26.2.5.2 on Ubuntu 24.04, with an Epson WF-7525
(CUPS + Gutenprint 5.3.4). Adding data that may help, since comment 26 mentions
the issue could not be reproduced from the PPD alone. Three points below: this
is a media-selection problem rather than an orientation problem, it can be
reproduced without the physical printer, and removing a single line from the
PPD fixes it.

What LibreOffice actually sends

Printing a plain A4 portrait document, the IPP attributes of the spooled job
contain:

Duplex          None
InputSlot       tray1
PageSize        ARCHA_trans
document-format application/pdf

orientation-requested is absent. LibreOffice is not asking for a rotation — it
is asking for a different medium. ARCHA_trans ("ArchA transposed") is 864 x 648
pt, i.e. wider than it is tall. An A4 portrait page laid on it comes out
rotated and clipped, which is exactly the reported symptom.

The same queue prints the same document correctly via lp with no options, so
the CUPS filter chain, the PPD and the Gutenprint driver are not involved.

Why this PPD triggers it

The attached PPD declares 98 page sizes. Computing, for each entry, the
distance to A4 (595 x 842 pt) both directly and with width/height swapped:

direct    : A4(0), RA4(36), 8x12(41), Letter(67)
transposed: ARCHA_trans(75), 8x10(391), YonKire(391), Crown Quarto(409)

Two observations:

An exact A4 entry exists (line 84), yet ARCHA_trans is selected.
ARCHA_trans is the single best transposed match for A4 among all 98 entries,
ahead of the runner-up by a factor of 5. It is also the only entry in the whole
file whose width exceeds its height.

This is consistent with the commit identified by the bibisect in comment 19
(6005aeca, "swap job orientation if paper matching swapped width/height"): a
paper size with the orthogonal orientation is picked, and the job orientation
is then swapped to match it.

Why A3 is not affected — and why large-format printers are

On the very same queue and the same PPD, an A3 portrait document is sent
correctly as PageSize=A3.

The numbers explain the asymmetry. For A3 (842 x 1191 pt) the closest
transposed match is 493 away, versus 75 for A4. No medium in this PPD is wide
enough (max width 918 pt) to hold an A3 sideways, so nothing orthogonal is
close enough to be picked.

This is the same pattern reported in comments 6, 9 and 10, mirrored: on a Canon
iX6820 and an Epson 3880, tabloid prints correctly while Letter, Legal and
smaller sizes fail.

The common factor across every report in this bug is a large-format (A3 /
tabloid-capable) printer. That is a necessary condition rather than a
coincidence: the paper size must be small enough, relative to the printer's
maximum media width, that a transposed medium of comparable size exists in the
PPD. On an A4-only printer no such candidate exists and the bug cannot appear,
which is why the vast majority of users never see it. Known affected models so
far: Canon iX6820, Epson Stylus Pro 3880, Epson WorkForce 7520, Epson WorkForce
7525.

Reproducing without the printer

The faulty value can be observed without printing a single sheet, on any
machine, using the attached PPD. Create a queue pointing at a dead socket, hold
it, print, and read the spooled job attributes. Verified working here:

bash
sudo lpadmin -p TDF154975 -E -v socket://127.0.0.1:9100 -P
/path/to/EPSON_WF-7525_Series.ppd
cupsdisable TDF154975

Then, from LibreOffice Writer, create a new empty document (Ctrl+N), type one
line, and print it to TDF154975 with the page style left at A4 portrait.

bash
lpstat -W not-completed -o TDF154975
sudo sh -c 'strings -n 2 $(ls -t /var/spool/cups/c000* | head -1) | grep -A1 -i
pagesize'

Expected: PageSize A4. Observed here: PageSize ARCHA_trans.

Repeating on the same queue with the page style set to A3 (Format > Page Style

Page, 29.7 x 42 cm) yields PageSize A3, correctly. Same queue, same PPD, same
fresh document — only the page format differs.

Cleanup:

bash
cancel -a TDF154975
sudo lpadmin -x TDF154975
Minimal fix, verified

Deleting the four ARCHA_trans lines from the PPD — one each in the *PageSize,
*PageRegion, *ImageableArea and *PaperDimension blocks — is sufficient. The
remaining 97 page sizes are untouched:

bash
sed -i -E '/^\*(PageSize|PageRegion|ImageableArea|PaperDimension)
ARCHA_trans[\/:]/d' the.ppd

With that PPD, an A4 document is sent as A4 and prints correctly on paper; A3
still works. Note what LibreOffice does not do here: it does not fall back to
the next-closest transposed candidate (8x10 or YonKire, both at 391), it falls
back to the direct match. So the trigger appears to be the mere presence of a
landscape-shaped medium in the PPD, not a distance threshold.

For completeness, reducing the PPD to A4 and A3 only also works, but is not
necessary.

What was ruled out
The document. A newly created empty document is enough. The original .docx had
a single sectPr with w:pgSz w:w="11906" w:h="16838" and no w:orient.
The user profile. Reproduced with a throwaway profile
(-env:UserInstallation=file:///tmp/lo-test-profile).
The LibreOffice version. Identical behaviour on 24.2.7.2 and 26.2.5.2.
CUPS defaults. Neither /etc/cups/lpoptions nor ~/.cups/lpoptions exists; the
queue carries no PageSize or orientation-requested default; /etc/papersize is
a4.
The PPD. *DefaultPageSize, *DefaultPageRegion, *DefaultImageableArea and
*DefaultPaperDimension are all A4; *LanguageVersion: English, so no translated
option names could collide.
Stored printer settings. ~/.config/libreoffice/4/user/psprint/ is empty and
registrymodifications.xcu holds no PrinterSettings node.

Happy to run further tests on this hardware if that helps.
PPD causing the problem is attached.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to