Portrait prints in Landscape on Epson 3880

Libreoffice on FreeBSD 12.4; also on Ubuntu 22.04
Libreoffice on Ubuntu 22.04 (different system) works.
All systems using cups
Printer (epson stylus pro 3880) prints fine using lpr, xpdf, cups test page, and gimp via system print dialog and gutenprint. But in libreoffice writer and calc, portrait prints as landscape.
I’ve tried using a smaller (A4) page; same problem.
In the print dialog, the preview is in portrait orientation.
Setting orientation explicitly in the print dialog makes no difference (Auto, Portrait, Landscape); they all print landscape.
If I open pinter properties from the print dialog, paper size and orientation are greyed out (Letter, Portrait). If I check “Use only paper size from printer preferences,” they become settable, but setting them still has no effect.
If I export as pdf, the pdf appears as portrait in xpdf and prints fine from xpdf.
If I print to file (default produces .pdf), then use the following command, it prints fine: “/usr/local/bin/lpr foo.pdf”
If I explicitly set different orientations using lpr, e.g.
/usr/local/bin/lpr -o orientation-desired=6 foo.txt
it prints in the proper orientation for orientations 0 - 6, so the cups system is doing what it is supposed to. (not sure what 0-4 do, but 0,2,4 print landscape and 1,3 print portrait).
Suggestions? Is anyone else running LO or on a bsd/linux system and printing to epson stylus pro printers and having this problem?

Please upload one or two sample files created in your LO versions…

Here’s a freshly created 2 lineer
PortraitPrintsAsLandscape_1.odt (11.9 KB)

I’ve upgraded my os from freebsd 12.4 to 13.2 and reinstalled everything, with the same results. The same file uploaded here still prints in landscape.

This is a problem with large format printers.
See bug #154975

I suppose that is related to the DEFAULT orientation of the standardized size sheets… The default (physical) orientation of an A/4 page is “Portrait” but the default orientation of an A/3 page is the “Landscape”. In other words the Portrait/Landscape are “relative” orientations based on the position of the “longer edge” of the sheet.

Maybe the bugous code make equals the “DEFAULT” state to the “PORTRAIT” state, because it is a “good approximation for most of printers”,

@Zizi64 Specifically setting portrait or landscape has no affect on my Epson 3880 when printing Letter or Legal paper. What printer are you testing with, and what paper sizes?

I am using A/4 size printers (mainly multifunction Brothers laser printers and one OKI A/3 size laser printer) and they work fine with the LO 7.5.8 on Windows 10.
I just supposed the root of the issue.