Bug 159995 - LibreOffice Calc won't respect page settings for printing on macOS
Summary: LibreOffice Calc won't respect page settings for printing on macOS
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.2.0.3 release
Hardware: All macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:25.8.0 target:25.2.0.2 target:...
Keywords:
Depends on:
Blocks: Print-Dialog
  Show dependency treegraph
 
Reported: 2024-03-02 11:08 UTC by M-Rick
Modified: 2025-01-13 05:28 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
LibreOffice Calc: Pages settings defined as A3 and no margins (1.72 MB, image/png)
2024-03-02 11:10 UTC, M-Rick
Details
LibreOffice Calc: settings aren't respected at all in macOS (577.19 KB, image/png)
2024-03-02 11:11 UTC, M-Rick
Details
Numbers: same table with same settings (869.88 KB, image/png)
2024-03-02 11:12 UTC, M-Rick
Details
Numbers: Page settings allows to set the paper size, orientation and settings are respected. (881.52 KB, image/png)
2024-03-02 11:13 UTC, M-Rick
Details
Numbers: print menu keeping the print settings (1.35 MB, image/png)
2024-03-02 11:14 UTC, M-Rick
Details
Numbers: result in Preview as expected in A3 and no margins (618.29 KB, image/png)
2024-03-02 11:15 UTC, M-Rick
Details
Windows: works as expected (59.56 KB, image/png)
2024-03-02 11:17 UTC, M-Rick
Details
Linux: works as expected (89.29 KB, image/png)
2024-03-02 11:17 UTC, M-Rick
Details
Snapshot of printing multiple pages per sheet in non-native print dialog (1020.21 KB, image/png)
2024-12-30 18:58 UTC, Patrick (volunteer)
Details
PDF output using RWTS "print to PDF" printer using non-native print dialog (10.13 KB, application/pdf)
2024-12-30 18:59 UTC, Patrick (volunteer)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description M-Rick 2024-03-02 11:08:48 UTC
Description:
The LibreOffice Calc version of macOS has really bad respect of print settings.

If I want a page to be exported as PDF in A3 size using the build PDF printer in LibreOffice Calc in macOS, the page will always be resized to A4 waterer the settings are.
Plus, it adds a margin all around while the margins have been set to 0 everywhere. And it's impossible to set the page orientation, unlike Linux and Windows versions.
So I need to trick by using multiple columns. But LibreOffice will add a margin all around on both of them. This doesn't happen with Linux and Windows versions as well.
The PDF export will not respect print settings as it export the whole content as this and doesn't provide an option to remove blank pages…

It's a LibreOffice bug, since I tried exactly the same settings in macOS Numbers and it works perfectly. plus there is a global printing setting unavailable in LibreOffice.

Steps to Reproduce:
1. Create a Calc spreadsheet and set it up to A3 with 0 cm margins.
2. Go to print and set 2 pages per file and enable to fit to paper size.
3. Use the PDF menu to open in Preview or save as PDF.
4. Check the size, it's A4…

Actual Results:
Printed in A4 and add black space around datas.

Expected Results:
Should respect the settings and use a A3 size.
Shouldn't add black space around printed datas if margins are set to 0.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
The problem is old and available in all LibreOffice Mac versions even if I tagged the latest one.
Comment 1 M-Rick 2024-03-02 11:10:42 UTC
Created attachment 192902 [details]
LibreOffice Calc: Pages settings defined as A3 and no margins
Comment 2 M-Rick 2024-03-02 11:11:47 UTC
Created attachment 192903 [details]
LibreOffice Calc: settings aren't respected at all in macOS
Comment 3 M-Rick 2024-03-02 11:12:30 UTC
Created attachment 192904 [details]
Numbers: same table with same settings
Comment 4 M-Rick 2024-03-02 11:13:28 UTC
Created attachment 192905 [details]
Numbers: Page settings allows to set the paper size, orientation and settings are respected.
Comment 5 M-Rick 2024-03-02 11:14:13 UTC
Created attachment 192906 [details]
Numbers: print menu keeping the print settings
Comment 6 M-Rick 2024-03-02 11:15:00 UTC
Created attachment 192907 [details]
Numbers: result in Preview as expected in A3 and no margins
Comment 7 M-Rick 2024-03-02 11:17:24 UTC
Created attachment 192908 [details]
Windows: works as expected
Comment 8 M-Rick 2024-03-02 11:17:46 UTC
Created attachment 192909 [details]
Linux: works as expected
Comment 9 Stéphane Guillou (stragu) 2024-06-13 15:24:37 UTC
Does the size available depend on which printer is the default?
I that's the case, you might be experiencing bug 152272.
Comment 10 QA Administrators 2024-12-11 03:13:02 UTC Comment hidden (obsolete)
Comment 11 Patrick (volunteer) 2024-12-27 16:33:27 UTC
I can reproduce this bug by opening the test file in https://bugs.documentfoundation.org/attachment.cgi?id=187050 and changing the size of the page to A3 via the Format > Page Style menu. Printing still sets the paper size to A4:

Version: 24.8.4.2 (AARCH64) / LibreOffice Community
Build ID: bb3cfa12c7b1bf994ecc5649a80400d06cd71002
CPU threads: 8; OS: macOS 15.2; UI render: Skia/Metal; VCL: osx
Locale: en-CA (en_CA.UTF-8); UI: en-US
Calc: threaded
Comment 12 Patrick (volunteer) 2024-12-29 00:59:16 UTC
So after much debugging and testing, I now believe that the unwanted borders are a macOS hardcoded bevavior. See the following post for more details:

https://bugs.documentfoundation.org/show_bug.cgi?id=155124#c14

So, looks the only other possible approach is to duplicate the multiple sheets per page settings elsewhere in the print dialog and use those duplicate settings to do the multi-page layout during LibreOffice's print processing phase.

If we are able to implement tdf#163558, that would add orientation and paper size near the top of the native print dialog. Then, if we could figure out how to add the sheets per page listbox from the Windows/Linux print dialog in the native print dialog, you wouldn't need to set anything in the print dialog's Layout or Paper Handling sections.

Not sure when I'll have time to work on this, but if this can be implemented the sheets per page in the Layout section would be left at "1" and the new duplicate sheets per page (it would be in the LibreOffice section) would be set to "2" so that the existing pages per sheet can be left at "1" for no borders.

In theory, you could then do something wild like group X number of zero-margin pages in the LibreOffice section, and then group Y number of LibreOffice pages onto each output page with borders around each LibreOffice group.
Comment 13 Commit Notification 2024-12-30 18:40:48 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/09484a1befd41681276cc9909b3228e5bf28a76e

Related: tdf#159995 fix pages per sheet in the non-native print dialog

It will be available in 25.8.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 Patrick (volunteer) 2024-12-30 18:56:26 UTC
I have committed the first phase of fixes for this bug. However, this first phase does *not* fix this bug but it does enable a workaround that you can use to print multiple pages per sheet with no border. In the next phase, I will see if I can add support for LibreOffice's handling of multiple pages per sheet in the native print dialog.

I will post instructions for using the non-native print dialog workaround in a separate comment.

Anyway, to use the workaround, you will need to use tomorrow's (31 December 2024) nightly master builds:

https://dev-builds.libreoffice.org/daily/master/current.html

Note for macOS testers: the nightly master build installer does not overwrite any LibreOffice official versions. Instead, it will be installed as a separate application called "LibreOfficeDev" in the /Applications folder.

Because this is a "test" build, you will need to do the following steps before you launch the LibreOfficeDev application:

1. Go to the Finder and navigate to the /Applications/Utilities folder
2. Launch the "Terminal" application
3. Paste the following command in the Terminal application window and press the Return key to execute the command:

   xattr -d com.apple.quarantine /Applications/LibreOfficeDev.app
Comment 15 Patrick (volunteer) 2024-12-30 18:58:27 UTC
Created attachment 198331 [details]
Snapshot of printing multiple pages per sheet in non-native print dialog
Comment 16 Patrick (volunteer) 2024-12-30 18:59:40 UTC
Created attachment 198332 [details]
PDF output using RWTS "print to PDF" printer using non-native print dialog
Comment 17 Patrick (volunteer) 2024-12-30 19:16:49 UTC
As I mentioned in comment #14, there is a workaround using LibreOffice's non-native print dialog. To use the workaround, do the following steps:

1. Download and install the a nightly master build dated 31 December or later using the steps in comment #14.

2. Launch /Applications/LibreOfficeDev.app (i.e. the default installation location for nightly master builds).

3. Select the LibreOffice > Settings menu item (or LibreOffice > Preferences in older macOS versions) and in the Options dialog that appears, select LibreOfficeDev > Advanced in the sidebar on the left.

4. In the sidebar on the right, click the Open Expert Configuration button. In the dialog that appears, search for UseSystemPrintDialog and then change UseSystemPrintDialog to false".

5. Press the OK button to close each of the above dialogs, open your document, and print using either selecting the File > Print menu item or pressing Command-P.

6. The non-native print dialog should appear. Set the print settings like in attachment #198331 [details] and press the Print button.

One big limitation with this workaround is that the setting the non-native print dialog's printer to "Print to File..." has some bugs and won't allow you to change the paper size so you can only set the printer to a real printer.

So, if you only want to output a PDF file, you will need to also install a "print to PDF" printer. I use the following free, open source "print to PDF" printer which basically just takes any print output sent to it and writes the output to a PDF file in your ~/PDFWriter folder:

https://github.com/rodyager/RWTS-PDFwriter/releases
Comment 18 Commit Notification 2024-12-31 06:03:49 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/19ccc27e670bbab546781f22e2832ce07eccc2dd

Related: tdf#159995 fix pages per sheet in the non-native print dialog

It will be available in 25.2.0.2.

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 19 Commit Notification 2024-12-31 06:03:52 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/5c2484126ac54545c9b81e62ffa2c4e4c5275483

Related: tdf#159995 fix pages per sheet in the non-native print dialog

It will be available in 24.8.5.

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 20 Commit Notification 2024-12-31 19:36:05 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/61f8fb648ecf9a20ee8abec0e8d3fad3e666db5e

Related: tdf#159995 allow setting the page size when printing to file

It will be available in 25.8.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 21 Patrick (volunteer) 2024-12-31 22:32:22 UTC
(In reply to Patrick (volunteer) from comment #17)
> One big limitation with this workaround is that the setting the non-native
> print dialog's printer to "Print to File..." has some bugs and won't allow
> you to change the paper size so you can only set the printer to a real
> printer.

I have committed a fix for the various bugs when using the "Print to File..." printer in the non-native print dialog. The fix will be in tomorrow's (01 January 2025) master nightly builds and with the fix you will no longer need to install a "print to PDF" printer.

Ignore the steps in comment #17 and use the following steps instead:

1. Download and install the a nightly master build dated 01 January 2025 or later using the steps in comment #14.

2. Launch /Applications/LibreOfficeDev.app (i.e. the default installation location for nightly master builds).

3. Select the LibreOffice > Settings menu item (or LibreOffice > Preferences in older macOS versions) and in the Options dialog that appears, select LibreOfficeDev > Advanced in the sidebar on the left.

4. In the sidebar on the right, click the Open Expert Configuration button. In the dialog that appears, search for UseSystemPrintDialog and then change UseSystemPrintDialog to false".

5. Press the OK button to close each of the above dialogs, open your document, and print using either selecting the File > Print menu item or pressing Command-P.

6. The non-native print dialog should appear. Set Printer to "Print to PDF...", set the print settings like in attachment #198331 [details] and press the "Print to File..." button.
Comment 22 Commit Notification 2025-01-01 06:55:57 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

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

Related: tdf#159995 allow setting the page size when printing to file

It will be available in 24.8.5.

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 23 Commit Notification 2025-01-01 06:56:00 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/489563aa93bff1a175006d77a917f10e4493d727

Related: tdf#159995 allow setting the page size when printing to file

It will be available in 25.2.0.2.

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 24 M-Rick 2025-01-02 23:30:53 UTC
(In reply to Patrick (volunteer) from comment #17)
> As I mentioned in comment #14, there is a workaround using LibreOffice's
> non-native print dialog. To use the workaround, do the following steps:
> 
> 1. Download and install the a nightly master build dated 31 December or
> later using the steps in comment #14.
> 
> 2. Launch /Applications/LibreOfficeDev.app (i.e. the default installation
> location for nightly master builds).
> 
> 3. Select the LibreOffice > Settings menu item (or LibreOffice > Preferences
> in older macOS versions) and in the Options dialog that appears, select
> LibreOfficeDev > Advanced in the sidebar on the left.
> 
> 4. In the sidebar on the right, click the Open Expert Configuration button.
> In the dialog that appears, search for UseSystemPrintDialog and then change
> UseSystemPrintDialog to false".
> 
> 5. Press the OK button to close each of the above dialogs, open your
> document, and print using either selecting the File > Print menu item or
> pressing Command-P.
> 
> 6. The non-native print dialog should appear. Set the print settings like in
> attachment #198331 [details] and press the Print button.
> 
> One big limitation with this workaround is that the setting the non-native
> print dialog's printer to "Print to File..." has some bugs and won't allow
> you to change the paper size so you can only set the printer to a real
> printer.
> 
> So, if you only want to output a PDF file, you will need to also install a
> "print to PDF" printer. I use the following free, open source "print to PDF"
> printer which basically just takes any print output sent to it and writes
> the output to a PDF file in your ~/PDFWriter folder:
> 
> https://github.com/rodyager/RWTS-PDFwriter/releases

Your workaround is perfect! I even got it working with the 24.2 version as well!
Thank you.