Bug 166185 - Some text is not printed in landscape
Summary: Some text is not printed in landscape
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4 all versions
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:26.2.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Print-Dialog
  Show dependency treegraph
 
Reported: 2025-04-14 19:11 UTC by Xisco Faulí
Modified: 2025-10-24 12:54 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot (143.46 KB, image/png)
2025-04-14 19:11 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2025-04-14 19:11:05 UTC
Created attachment 200342 [details]
screenshot

Steps to reproduce:
1. Open Writer
2. Type "Hello World"
3. File - Print
4. Change orientation to Landscape

-> No text is displayed in the print preview.

1. Open Writer
2. Type LOREM + F3
3. File - Print
4. Change orientation to Landscape

-> Half of the text is displayed. See screenshot

Reproduced in

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 403b1dd4808f72a2cd5cd6397f1610d41882eb01
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded
Comment 1 Xisco Faulí 2025-04-14 19:12:41 UTC
This issue started to happen after

commit 324daa38a823477e1d1b650b5d91f3dc91c6a9af	[log]
author	Justin Luth <justin_luth@sil.org>	Tue Nov 23 09:18:20 2021 +0200
committer	Justin Luth <jluth@mail.com>	Tue Nov 23 11:05:19 2021 +0100
tree 6e7d74ffed4b89533bedaa5aecf768d229e064a8
parent 1f99fc7f94a27da5e8a00da7e74dc155780a139b [diff]

tdf#129638 print preview: use new paper size after switching page

However, a follow-up patch was submitted later on related to this topic:

commit ddaebfb270c4b52ddebaf678a9352312c75247fa	[log]
author	Luboš Luňák <l.lunak@collabora.com>	Mon Jan 31 20:27:54 2022 +0100
committer	Luboš Luňák <l.lunak@collabora.com>	Tue Feb 01 11:16:43 2022 +0100
tree e64bb9ecbcece35a7cd4adb4b8c66bfead2ddc0b
parent de5aa409353c839483df21d47254fd2a508ab7d9 [diff]

fix the orientation combobox in the print dialog

if both commits are reverted then the issue is not reproducible
Comment 2 Justin L 2025-09-19 19:39:24 UTC Comment hidden (obsolete)
Comment 3 Aron Budea 2025-09-20 02:37:31 UTC
I could reproduce it in 26.2.0.0.alpha0+ (b24d9ab858a142b806822ba038d3173d35589626) / Windows (didn't check in Linux).
Comment 4 Justin L 2025-10-22 12:54:17 UTC
Ahh - I was always (as my last step) changing the printer to print-to-PDF and then printing. The act of "changing printers" refreshes both the print preview and the actual printout.

So yes, I can reproduce that the resulting PDF is wrong, so this affects both the print preview and the actual print itself.

However, I don't see why you pointed to my commit as "it started to happen". Bibisect works fine for me at that point - both preview and final output. (However, as part of reverse fixing, I do confirm that removing Luboš commit results in an 'unchangeable' preview/print.)

I can confirm via bibisect that the described problem starts with Luboš' 7.4 commit (although I haven't been able to find anything particularly wrong with anything in his commit).

It looks like an area where 'if you touch it, it will break'.
Comment 5 Justin L 2025-10-23 17:27:25 UTC
This bug report isn't as bad as it sounds. LO has NEVER done any scaling when forcing into portrait or landscape mode. So part of the page was always missing in these situations. The only thing that is different is that now (in 7.4) everything is centred (again) rather than top-left-margin aligned (which started in 6.3).

4.4: refused to let me choose portrait/landscape. (same in 5.4)
OOo: no scaling - looks pretty-much like today. (same in 3.6.7, same in 6.2)

In 6.3, the dialog changed significantly, and it (wrongly) started to do a full re-layout of the document to fit landscape/portrait. 
git log cb443d07d54d6698eff51b5be2c6b5..bc0146c2ae43256552c276d2dd8629

first commit bc0146c2ae43256552c276d2dd86291c98556c42
Author: Daniel Silva on Wed Nov 28 19:28:26 2018 -0200

The re-layout stopped with commit eaec995a96b41963ae9e5156b6c5c7ac022f9a55
Author: Daniel on Wed Jan 16 18:51:47 2019 -0200
    tdf#122079 - Document orientation is no longer changed in print dialog
    Reviewed-on: https://gerrit.libreoffice.org/66483
but top-left-margin alignment still exists - giving OP's desired outcome.

I assume that what actually happened is that somehow the implementation changed so that this centring code no longer was triggered in vcl/source/gdi/print3.cxx
        if( aPaperSize != aPageSize.aSize )
            // user overridden page size, center Metafile...

For this bug report, your perspective on whether Luboš fixed things or broke things will depend on the document contents. Since we don't do any scaling, a simple centring on the assigned papersize/orientation seems like the most correct thing to do. Certainly it is a logical choice.
Comment 6 Commit Notification 2025-10-24 00:30:55 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d56690047760392cbdd512590f4f53f591d5aae8

tdf#166185 vcl print preview: only ORIENTATION_AUTOMATIC resizes paper

It will be available in 26.2.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 7 Commit Notification 2025-10-24 01:22:03 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/cae2ae964468b3aa5b773676a4c67b40e305725e

tdf#166185 vcl PrinterController: auto orient in getRealPaperSize

It will be available in 26.2.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 2025-10-24 01:25:05 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c02bef3a272f6d93669c4e0b51606dcdf56fe425

tdf#166185 vcl PrinterController: oversized? align top, not center

It will be available in 26.2.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 Justin L 2025-10-24 12:54:10 UTC
(In reply to Justin L from comment #4)
> It looks like an area where 'if you touch it, it will break'.
Not planning to backport anything here...