Bug 151107 - Print Preview in Print dialog: page orientation depends on moving forward or backwards through print previews
Summary: Print Preview in Print dialog: page orientation depends on moving forward or ...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All All
: medium normal
Assignee: Caolán McNamara
URL:
Whiteboard: target:7.5.0
Keywords:
Depends on:
Blocks: Print-Dialog Print-Preview
  Show dependency treegraph
 
Reported: 2022-09-21 13:43 UTC by Telesto
Modified: 2023-01-11 01:02 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2022-09-21 13:43:15 UTC
Description:
Print Preview: page orientation depends on moving forward or backwards through print preview

Steps to Reproduce:
1. Open attachment 181979 [details]
2. Press Print button -> Dialog appears
3. Press the arrow right button of the print preview until you reach page 4: portrait orientation
4. press the arrow right button 
5. press the arrow left button (back to page 4) -> landscape orientation

Actual Results:
Portrait orientation

Expected Results:
Consistent result: I assume it should be landscape. 


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: dc92a4d973086ce8a6a5f75ba0f4d4c9ca05537a
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 Telesto 2022-09-21 13:47:14 UTC
Also in
Version: 6.2.9.0.0+ (x86)
Build ID: 5f01fe15eb2661f1f9ce12d1d99dc2a705b462ee
CPU threads: 4; OS: Windows 6.3; UI render: default; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL

Fine - meaning consistent result - portrait orientation, with
6.1
Comment 2 Julien Nabet 2022-09-21 18:42:46 UTC
On pc Debian x86-64 with master sources updated today, I got the exact opposite pb.
At step 3 when I reach page 4, I got landscape orientation.
But if I click right arrow button the left arrow button, it becomes portrait orientation.

Anyway, let's put this one as New since there's indeed a pb here.
Comment 3 Julien Nabet 2022-09-21 20:26:01 UTC
I gave a try with this:
https://gerrit.libreoffice.org/c/core/+/140358

but I must recognize I'm not sure it's the right thing to do, printing part is quite tricky.
Comment 4 Regina Henschel 2022-09-21 22:08:31 UTC
I cannot confirm the behavior. The print preview and the preview in the print dialog both show the correct size and orientation. I have tested it with Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 349e3af0c5dd5ed495ed61aab526f63c16f0e215
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL threaded
Comment 5 Julien Nabet 2022-09-22 04:58:50 UTC
I may be wrong but I think it depends on the printer driver LO uses. In my case the page size of the fourth page is unknown so it uses the same orientation as the previous page.
Page 3 is A4 landscape, so when we go to next page, it stays landscape (which is the correct orientation).
But if we go page 5, LO recognize A4 too but in portrait so, when going back to page 4, it stays portrait.

Now I must recognize I don’t understand why Telesto has the opposite result for page 4.
Comment 6 Caolán McNamara 2022-09-22 10:35:47 UTC
Looks like we have something of an inconsistency in our paper sizes in the fallback vcl/unx/generic/printer/configuration/ppds/SGENPRT.PS

*PageSize EnvC5/C5 Envelope: "<</PageSize [459 649] /ImagingBBox null>> setpagedevice"
*PageSize EnvC6/C6 Envelope: "<</PageSize [323 459] /ImagingBBox null>> setpagedevice"
...
*PageSize EnvC65/C65 Envelope: "<</PageSize [324 648] /ImagingBBox null>> setpagedevice"

Where EnvC65 has a 1 point difference from EnvC6 width and a 1 point different from EnvC5 height. So this EnvC65 ends up as
{m_eType = PAPER_USER, m_nPaperWidth = 11430, m_nPaperHeight = 22860} (e.g. 324 points / 72 points in an inch => 4.5in -> 11430 10ths of mm.

While aDinTab in i18nutil/source/utility/paper.cxx has...

{m_nWidth = 11400, m_nHeight = 22900, m_pPSName = 0x7ffff70325eb "EnvC65"

so is 30 units width and 40 units height different from the accurate value, while our sloppy fit allows a 21unit diff.

In my case the SGENPRT.PS fallback is getting used, different people with different printers may see different results.
Comment 7 Commit Notification 2022-09-22 12:24:39 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/971804673efa7f461be21589d9e9bf0f982b8b54

Related: tdf#151107 EnvC65 page size is inconsistent with EnvC5 and EnvC6

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2022-09-22 12:25:50 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/64e4363527422c913151efab0c0d0c6b8c2256c8

Related: tdf#151107 make "sloppy" paper fit up to 1.25pt

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Julien Nabet 2022-09-22 12:31:53 UTC
Unassign myself since Caolán pushed the right fix.
Comment 10 Commit Notification 2022-09-22 14:31:44 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7d95a22245e3a031016e403aafddc00a73008b74

Revert "Related: tdf#151107 make "sloppy" paper fit up to 1.25pt"

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Telesto 2022-09-22 15:02:46 UTC
Reminder to future me: Different case, which needs to checked; 
1. Open Impress (empty sheet or template)
2. CTRL+P -> Preview Landscape (OK)
3. Change the suggested Paper Size from A4 to B5 (or something else) in the Print Dialog
4. Change the Paper Size back to A4 -> Print Preview in Portrait -> Should be Landscape, IMHO
Comment 12 Caolán McNamara 2022-09-22 15:30:33 UTC
The problem seems to arise when no suitable paper was found for the printer and the "orientation" is left at whatever was the orientation of the last paper that was seen. What I've done so far is to get the paper to match against "C65" so this specific case probably doesn't happen, but I have a follow up I want to try for the now hidden problem
Comment 13 Commit Notification 2022-09-22 17:40:45 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6005aeca4416eb0d583fd12ab837afa91d9d18ec

tdf#151107 swap job orientation if paper matching swapped width/height

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Caolán McNamara 2022-09-22 17:43:36 UTC
let give that a go then
Comment 15 Julien Nabet 2022-09-22 18:18:51 UTC
I confirm it works now (f24841da29adb8c0b4a8ec1b29367ee63998d440)
Thank you Caolán for the patches!

Telesto: instead of putting VERIFIED right now, I prefer letting you give a try with a daily build including Caolán's patches since you had a behavior opposite to the one I had.
Comment 16 Commit Notification 2022-09-22 18:42:27 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/40a428fde0a33e7127dfa30845d65c698e408053

Related: tdf#151107 make "sloppy" paper fit up to 1.25pt

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Telesto 2022-09-26 19:15:16 UTC
(In reply to Julien Nabet from comment #15)
> Telesto: instead of putting VERIFIED right now, I prefer letting you give a
> try with a daily build including Caolán's patches since you had a behavior
> opposite to the one I had.

Working like a charm:
Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: d3050ff4a1355f7ebd3d4e7ddc8fb64f2b8894dd
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