Bug 151136 - Print Dialog: List of paper sizes needs logical sorting; missing information makes entries look like duplicates
Summary: Print Dialog: List of paper sizes needs logical sorting; missing information ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.5.0.0 alpha0+
Hardware: All All
: low normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevEval
Depends on:
Blocks: Print-Dialog
  Show dependency treegraph
 
Reported: 2022-09-22 15:21 UTC by Telesto
Modified: 2023-05-09 12:19 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Paper sizes returned by MSO for "XPS Document Writer" (69.04 KB, image/png)
2022-10-07 07:24 UTC, Heiko Tietze
Details
Screencast List of Paper Sizes (811.87 KB, image/gif)
2023-05-06 11:57 UTC, Telesto
Details
Screencast of the XPS printer own list of supported paper sizes (365.50 KB, image/gif)
2023-05-06 12:11 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2022-09-22 15:21:12 UTC
Description:
Print Dialog: list of available paper size is unsorted list (no logic at all) and contains a duplicate A4 paper size

Steps to Reproduce:
1. Open Writer
2. Pick some (virtual) printer like Microsoft XPS Printer
3. Expand drop down of the available paper sizes  

Actual Results:
No logic: it's isn't sorted in name (like A4) or Dimensions

Expected Results:
I would sort the labeled paper sizes by Name; and below it the unnamed paper size by size (width, in case of portrait orientation)


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 349e3af0c5dd5ed495ed61aab526f63c16f0e215
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL threaded
Comment 1 m_a_riosv 2022-09-22 18:24:40 UTC
Repro
Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: bfb0dbee201a69c26293947c78356f320ff62a0b
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Vulkan; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
Comment 2 Heiko Tietze 2022-09-23 06:41:15 UTC
(In reply to Telesto from comment #0)
> I would sort the labeled paper sizes by Name; and below it the unnamed paper
> size by size (width, in case of portrait orientation)

The function PrintDialog::setPaperSizes() iterates over printer data and adds the paper size with proper names to the list (not all sizes can be assigned to a name). The sequence seems to be defined by the printer.

Sorting by name is likely not an improvement, see https://opengrok.libreoffice.org/xref/core/vcl/inc/print.hrc (eg. 16k, A0..10, Arch A..E, B4..6, etc.).
Comment 3 Heiko Tietze 2022-10-07 07:24:56 UTC
Created attachment 182895 [details]
Paper sizes returned by MSO for "XPS Document Writer"

We discussed the topic in the design meeting.

The sorting probably comes from the printer target, for example spreads FAX A0..6 across the options. Alphabetical sorting likely fails as U.S. sizes [1] uses Ledger, Tabloid, Legal, Letter with Quarto, Government, Demitab... etc. 

Consequently we could resolve the ticket as NOB (my take) or predefine a sort order that would be applied to the list.

Second part of the report are the duplicates, which I can confirm for the "Microsoft XPS Document Writer" on Windows. But no other printer and of course not on Linux. MSO has different names for the paper types although it apparently has the same size.

[1] https://en.wikipedia.org/wiki/Paper_size#North_American_paper_sizes
Comment 4 Stéphane Guillou (stragu) 2023-05-05 21:26:24 UTC
I can see some seemingly-duplicated entries in the paper size dropdown for an Epson WF-7720, e.g.:

- A3 297mm × 420mm
- A3 297mm × 420mm
- A4 210mm × 297mm
- A4 210mm × 297mm

But if I use the same printer in Ubuntu's system print dialog, I can see them labelled as:

- A3
- A3 (Borderless)
- A4
- A4 (Borderless)

So I think it might be that LO does not display some of the differentiating metadata? Which would make this an enhancement request.
Telesto, can you see if a different app shows a distinction between the duplicated paper sizes?

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 83b1f6b58a30bdb589e9ce73deef39f021aebde1
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 5 Telesto 2023-05-06 11:57:40 UTC
Created attachment 187109 [details]
Screencast List of Paper Sizes

(In reply to Stéphane Guillou (stragu) from comment #4)
> I can see some seemingly-duplicated entries in the paper size dropdown for
> an Epson WF-7720, e.g.:
> 
> - A3 297mm × 420mm
> - A3 297mm × 420mm
> - A4 210mm × 297mm
> - A4 210mm × 297mm
> 
> But if I use the same printer in Ubuntu's system print dialog, I can see
> them labelled as:
> 
> - A3
> - A3 (Borderless)
> - A4
> - A4 (Borderless)
> 
> So I think it might be that LO does not display some of the differentiating
> metadata? Which would make this an enhancement request.
> Telesto, can you see if a different app shows a distinction between the
> duplicated paper sizes?

A nice observation :-). Surely something to investigate. However not exactly what I had in mind here. 

The initial point: there listing of paper size is rather erratic. I would - for example - group all ISO-216 paper size, and put those in order. Now everything is scattered the list without clear pattern of arrangement. 

Envelope sizes are also belonging together
Comment 6 Telesto 2023-05-06 12:11:46 UTC
Created attachment 187110 [details]
Screencast of the XPS printer own list of supported paper sizes

The screen shows:
A) Arrangement: ordered list (compared unordered in LibreOffice)
B) Labeling: all paper sizes have a name in for the XPS printer itself. However LibreOffice is mishmash labeling by name, and (fall-back) dimensions.


LibreOffice appears to use an internal list of paper dimensions and labels. And attempts to match those with the Printer Support paper sizes.

This instead of the paper sizes + labels from the printer driver itself.  The Print Preview in Chromium does list the printer supported paper sizes including their names. So it appears to be possible to extract labels + and sizes from the driver (and maybe even the order in which they are listed).