Bug 157680 - Impress export corrupted pdf on MacOS
Summary: Impress export corrupted pdf on MacOS
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.5.7.1 release
Hardware: All macOS (All)
: high normal
Assignee: Patrick Luby (volunteer)
URL: https://ask.libreoffice.org/t/impress...
Whiteboard: target:24.2.0 target:7.5.9 target:7.6...
Keywords: bisected, regression
Depends on:
Blocks: PDF-Export-Invalid
  Show dependency treegraph
 
Reported: 2023-10-10 09:36 UTC by maaaaaaaaaaartin
Modified: 2024-03-13 03:17 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
test ODP linked by OP (1.99 MB, application/vnd.oasis.opendocument.presentation)
2023-10-10 11:31 UTC, Stéphane Guillou (stragu)
Details
exported PDF linked by OP (3.64 MB, application/pdf)
2023-10-10 11:32 UTC, Stéphane Guillou (stragu)
Details
new test odp (1.73 MB, application/vnd.oasis.opendocument.presentation)
2023-10-10 14:42 UTC, maaaaaaaaaaartin
Details
old pdf export that was only slightly wrong (491.35 KB, application/pdf)
2023-10-10 14:42 UTC, maaaaaaaaaaartin
Details
new pdf export that is highly wrong (225.17 KB, application/pdf)
2023-10-10 14:43 UTC, maaaaaaaaaaartin
Details
Sample slide captured in OfficeLibre (507.86 KB, image/png)
2024-03-13 01:07 UTC, pabramowitsch
Details
Same slide captured from the ExportToPDF output file (283.03 KB, image/png)
2024-03-13 01:17 UTC, pabramowitsch
Details
Same slide in the PrintToPDF output file. (530.21 KB, image/png)
2024-03-13 01:18 UTC, pabramowitsch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description maaaaaaaaaaartin 2023-10-10 09:36:00 UTC
Description:
When I try to export a pdf from a odp (I am on MacOS 13.5 with a M1 CPU, I tried both LO 7.6.2, 7.5.7, 7.4.7) I get a corrupted (in the sense that several slides are almost entirely covered by white squares) pdf:
- odp (single problematic slide): https://www.dropbox.com/scl/fi/nynpzui9ldhiic6uya5iw/test.odp?rlkey=s7gvjcnybzqx5anrlgb0elrhh&dl=0 3
- pdf: https://www.dropbox.com/scl/fi/q65468v2veyy4j51igajf/test.pdf?rlkey=wy8vfaihtihnrohn73gy1ubql&dl=0
I asked the question here: https://ask.libreoffice.org/t/impress-export-to-pdf-is-corrupted, someone says it works fine on Windows. What can I do? Thanks in advance!
PDF

Steps to Reproduce:
Open odp file
Export to pdf

Actual Results:
pdf is corrupted

Expected Results:
pdf should not be corrupted


Reproducible: Always


User Profile Reset: Yes

Additional Info:
I am really stuck!
Comment 1 Stéphane Guillou (stragu) 2023-10-10 11:31:02 UTC
Works fine on Linux:

Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Will try macOS.
Comment 2 Stéphane Guillou (stragu) 2023-10-10 11:31:46 UTC
Created attachment 190109 [details]
test ODP linked by OP
Comment 3 Stéphane Guillou (stragu) 2023-10-10 11:32:08 UTC
Created attachment 190110 [details]
exported PDF linked by OP
Comment 4 Stéphane Guillou (stragu) 2023-10-10 11:42:02 UTC
Reproduced with:

Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 2; OS: Mac OS X 13.2.1; UI render: Skia/Raster; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 5 Stéphane Guillou (stragu) 2023-10-10 11:52:04 UTC Comment hidden (obsolete)
Comment 6 maaaaaaaaaaartin 2023-10-10 14:40:27 UTC
Thank you!

I cannot really tell when the problem appeared.

I just looked at my pdf exports from the past few years, and realize that the problem was actually already there, though more subtle (only one image dissapeared or something.), hence I never noticed.

Here is another odp: https://www.dropbox.com/scl/fi/znfr4lt89q8e3pdk3fnyu/test.odp?rlkey=oiql8nhdtwuu4yaq0lilcrxyn&dl=0
This was the pdf export I did in April 2022: https://www.dropbox.com/scl/fi/yn9nsj8v8ahxwzqkiy81j/test-old.pdf?rlkey=zagda2azpni4kakalx3blwpa1&dl=0
And this is the pdf export I did today: https://www.dropbox.com/scl/fi/rejzav8yggnkdqbupkz16/test-new.pdf?rlkey=wqgaxzhqhxuwpij1ye57enkvs&dl=0
Notice how the image was simply shrinked in the previous export, but now takes over most of the slide?

Can this be fixed?
Comment 7 maaaaaaaaaaartin 2023-10-10 14:42:02 UTC
Created attachment 190112 [details]
new test odp
Comment 8 maaaaaaaaaaartin 2023-10-10 14:42:41 UTC
Created attachment 190113 [details]
old pdf export that was only slightly wrong
Comment 9 maaaaaaaaaaartin 2023-10-10 14:43:19 UTC
Created attachment 190114 [details]
new pdf export that is highly wrong
Comment 10 Patrick Luby (volunteer) 2023-10-11 21:12:40 UTC
I can also reproduce this on macOS Sonoma on versions of LibreOffice starting from 7.5.7.

At first I thought it might be a bug in the Preview application, but the exported PDF looks the same in Adobe Acrobat Reader.

I will turn off compression in the exported PDF in my local master build and see if I can find anything in the PDF data that might be causing this bug.
Comment 11 Patrick Luby (volunteer) 2023-10-11 21:18:03 UTC
(In reply to Patrick Luby from comment #10)
> I can also reproduce this on macOS Sonoma on versions of LibreOffice
> starting from 7.5.7.

One more bug: when printing, a different set of areas are an empty color and both the export as PDF and printing bugs occur using Skia/Metal, Skia/Raster, and Skia disabled.
Comment 12 Patrick Luby (volunteer) 2023-10-11 23:18:26 UTC
So after some debugging, I found that the white areas when exporting to PDF are a result of my fix for https://bugs.documentfoundation.org/show_bug.cgi?id=156842.

If I remove that fix, there are no longer any white areas in the exported PDF. But, the 3 images in the box at the bottom of the slide are 1/8th their normal size. So, my first guess is that the scaling fix is getting applied to some other, unintended object.

I will post again when I have more news.
Comment 13 Stéphane Guillou (stragu) 2023-10-12 08:33:44 UTC
Thanks for looking into it, Patrick!

(In reply to Patrick Luby from comment #12)
> So after some debugging, I found that the white areas when exporting to PDF
> are a result of my fix for
> https://bugs.documentfoundation.org/show_bug.cgi?id=156842.

You're right, me reporting a repro in 7.4.6.2 is incorrect, I think I confused the outputs in my tests.

- 7.4.6.2 and 7.5.4.2: bottom three images are very small (what you fixed with bug 156842)
- 7.6.2.1: as OP shows.

Setting earliest version affected to 7.5.7 according to your tests, and marking as a regression given that even more of the slide is unreadable.
(but noting that content _is_ there, as shown by a Ctrl + A on the slide)

maaaaaaaaaaartin, if possible, can you confirm that in version 7.4.7, the output is different? (small pictures instead of large white area hiding objects)
Comment 14 maaaaaaaaaaartin 2023-10-18 09:48:40 UTC
Thank you for your help, and sorry for the late reply, as somehow I missed the last notificarion…

Yes, I can confirm this behavior.

Hope this can get fixed soon, as I desperately rely on pdf export… Thanks again!
Comment 15 Patrick Luby (volunteer) 2023-10-19 13:36:50 UTC
I have uploaded the following patch to fix that fixes this bug. There were actually two separate macOS-only bugs:

https://gerrit.libreoffice.org/c/core/+/157852

Once the patch eventually pass the automated tests, I will backport my fix to LibreOffice 7.5 and 7.6.
Comment 16 Commit Notification 2023-10-19 16:25:20 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "master":

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

tdf#157680 scale down size and adjust size and scale factor for /BBox

It will be available in 24.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 17 Commit Notification 2023-10-19 16:26:23 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

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

tdf#157680 scale down size and adjust size and scale factor for /BBox

It will be available in 7.5.9.

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 18 Commit Notification 2023-10-19 19:44:45 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

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

tdf#157680 scale down size and adjust size and scale factor for /BBox

It will be available in 7.6.3.

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 maaaaaaaaaaartin 2023-10-25 07:17:55 UTC
I can confirm the bug is gone with the current LibreOfficeDev, thank you so much Patrick!

(It seems current LibreOfficeDev does not read the gif objects from my odp files, but I guess I will open a new bug about it.)
Comment 20 BogdanB 2023-10-25 08:35:26 UTC
Verified based on comment 19.
Comment 21 maaaaaaaaaaartin 2023-10-26 06:53:13 UTC Comment hidden (obsolete)
Comment 22 Commit Notification 2023-10-26 18:27:32 UTC
Patrick Luby committed a patch related to this issue.
It has been pushed to "libreoffice-7-5-8":

https://git.libreoffice.org/core/commit/13e85421e58c2eb15bd5eb3b37af85abacdecb7e

tdf#157680 scale down size and adjust size and scale factor for /BBox

It will be available in 7.5.8.

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 pabramowitsch 2024-03-13 01:07:59 UTC
Created attachment 193086 [details]
Sample slide captured in OfficeLibre
Comment 24 pabramowitsch 2024-03-13 01:15:47 UTC
I wrote a long comment that the bug had reappeared, but it got lost:
Export to PDF from an LibreOffice Presentation.
LibreOffice 7.6.5.2   MacOS Sonoma 14.3.1
Slides are truncated.  
Tried all the suggestions posted about OpenCl,GL etc
PrintToPDF using the Mac printer, doesn't truncate but instead presents the 16:9 image in a square page.

I am submitting three attachments
Comment 25 pabramowitsch 2024-03-13 01:17:37 UTC
Created attachment 193087 [details]
Same slide captured from the ExportToPDF output file
Comment 26 pabramowitsch 2024-03-13 01:18:20 UTC
Created attachment 193088 [details]
Same slide in the PrintToPDF output file.
Comment 27 Stéphane Guillou (stragu) 2024-03-13 03:17:54 UTC
(In reply to pabramowitsch from comment #24)
> Export to PDF from an LibreOffice Presentation.
> LibreOffice 7.6.5.2   MacOS Sonoma 14.3.1
> Slides are truncated.  
This fix has been verified, so you might be encountering something different. Please do the following:
- open a new report (please mention this one)
- attach the original sample file you experience the issue with
Thank you!