Bug 167136 - Cannot export .odg file to a PDF file. PDF files are all corrupted
Summary: Cannot export .odg file to a PDF file. PDF files are all corrupted
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
25.2.3.2 release
Hardware: Other Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest, regression
Depends on:
Blocks:
 
Reported: 2025-06-20 19:29 UTC by forums.basil562
Modified: 2025-06-22 18:24 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Test .odg file to duplicate the problem (326.73 KB, application/vnd.oasis.opendocument.graphics)
2025-06-20 19:29 UTC, forums.basil562
Details
Corrupt PDF shows icons instead of content in Pages pane and in main display pane (130.33 KB, image/png)
2025-06-20 20:49 UTC, forums.basil562
Details
Two rectangles with rotation 333 degrees and 75% transparency that do not export to PDF correctly. (15.55 KB, application/vnd.oasis.opendocument.graphics)
2025-06-21 02:20 UTC, Alistair Saywell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description forums.basil562 2025-06-20 19:29:45 UTC
Created attachment 201382 [details]
Test .odg file to duplicate the problem

LibreOffice 24.2.4.3 (x86_64)
See below for system details

Cannot export .odg file to a PDF file.  The PDF is created, but it is corrupted.  After creation, upon opening it, the size is 37.4 MB, while the original .odg file is only 3267 KB.

I see numerous problems.  The original problem was that only the highlighted page would be included in the PDF.  Thereafter, more problems appeared in my many iterations trying to create the PDF, as described below.

1.  Regardless of what pages I highlight in the "Pages" pane, only the first page is properly formed in the resulting PDF created.  The other pages are blank except for a strange icon (see attached screen grabs).

2.  I cannot "Print... to File" The result is the same:  a PDF is created, but only the first page is correct.  The other pages have only the same strange icon on them.

I followed the instructions on this page:
https://wiki.documentfoundation.org/UserProfile#Default_locations

According to the information in the section "Help wizard (LibreOffice 5.3 and newer)" I do not have a corrupted user profile.  That is, I entered Safe Mode and opened the .odg file in question.  Trying to create a PDF by 1)  menu bar button and, 2) "Print to File..." dialog created the same malformed PDF file.

According to the page above, which says "If the problem persists, you can exit the safe mode because the user profile was not the cause of the problem." I do not have a corrupted user profile.

Additional symptoms are as follows.  Immediately after opening any corrupted PDF file created from the .odg file using Okular, my computer's fan starts spinning at maximum speed.  Upon terminating Okular, the okular process does not terminate but persists indefinitely until I kill it from the bash command line.

Additionally, baloo_file_extr starts running and continues running indefinitely.  If I kill it from the command line, it restarts.  This might be related to my having upgraded my system with "dnf update" which included the new KDE desktop. 

I also tried creating a PDF from the same source .odg file on a Windows 7 laptop running the same version of LibreOffice.  I got the same resulting corrupted PDF files every time.

I suspect that the problem is one of the following (but I'll just let you debug):
1.  corrupted .odg file
2.  other LibreOffice bug in PDF creation logic
3.  arbitrary Linux system problem (shared object, library, etc?)

I consider this a very a serious problem as I can not print my .odg files to PDF for distribution.

The details of my Linux system are as follows:

NAME="Fedora Linux"
VERSION="42 (KDE Plasma Desktop Edition)"
RELEASE_TYPE=stable
ID=fedora
VERSION_ID=42
VERSION_CODENAME=""
PLATFORM_ID="platform:f42"
PRETTY_NAME="Fedora Linux 42 (KDE Plasma Desktop Edition)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:42"
DEFAULT_HOSTNAME="fedora"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f42/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=42
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=42
SUPPORT_END=2026-05-13
VARIANT="KDE Plasma Desktop Edition"
VARIANT_ID=kde
Comment 1 forums.basil562 2025-06-20 19:39:13 UTC
One additional piece of important information....

I have 4 (four) versions of the .odg file I was creating as part of my project.  I was able to successfully create PDF files of the first 3 versions over the course of  the past 2 weeks.

But now I cannot even create a PDF of those .odg files.  The common denominator is the LibreOffice Draw executable.  This implies that the problem is the executable.

Is this latest executable corrupting every .odg file that it opens in some general way?  Or, is the PDF creation code just broken?  I don't know.
Comment 2 forums.basil562 2025-06-20 19:41:50 UTC
This is a serious problem.  One cannot even write a .odg file in a Microsoft file format in order to use Microsoft tools to create a PDF.
Comment 3 forums.basil562 2025-06-20 20:49:21 UTC
Created attachment 201383 [details]
Corrupt PDF shows icons instead of content in Pages pane and in main display pane

Notice that only Page 1 of the PDF is correct.  The other pages are corrupted somehow.  Instead of any content displaying, one sees only that strange icon.
Comment 4 Alistair Saywell 2025-06-20 22:43:36 UTC
The question was first asked on 
https://ask.libreoffice.org/t/libreoffice-draw-pdf-export-does-not-include-all-pages-of-odg-file/123441

It seems the problem is the pattern fill for Shape 1 (Custom Shape rectangle) on page 2. Replacing it with a colour fill allows creation of a pdf that Adobe Reader can read without crashing. Other pattern fills create the same problem.
Comment 5 forums.basil562 2025-06-20 23:10:57 UTC
I debugged the culprit.  The cause of the file corruption is the addition of bitmap patterns in geometric shapes.  

I removed all of the bitmap fills and the problem went away.  And the resulting PDF file was on the order of 300KB instead of 37MB...! 

Clearly a bug...!
Comment 6 Alistair Saywell 2025-06-21 02:20:05 UTC
Created attachment 201391 [details]
Two rectangles with rotation 333 degrees and 75% transparency that do not export to PDF correctly.

It seems to be the combination of pattern fill with rotation and transparency that cause problems in the PDF export.
The attached .odg opened in 25.2.3.2 or 25.8.0.0 beta 1 will create a 892 KB pdf that crashes Adobe Reader

The issue is not seen in 24.8.4.2 where the odg file exports to a modest 25 KB and opens immediately in Adobe Reader.
Comment 7 Regina Henschel 2025-06-21 18:22:09 UTC
Please test with a daily build, whether the fix for bug 166709 fixes this bug too. Bug 166709 was a similar problem for Writer.

Daily builds can be installed parallel to the regular build. Daily builds are available from https://dev-builds.libreoffice.org/daily/master/current.html
Comment 8 Saburo 2025-06-22 03:48:23 UTC
It seems that the bug has been fixed.
When the file (attachment 201382 [details]) is converted to PDF using Ver. 25.2.4.3, it becomes 9.9MB, and that PDF file could not be opened with Adobe Reader.
When the file (attachment 201382 [details]) is converted to PDF using Ver.26.2.0a, it becomes 845KB, and that PDF file could be opened with Adobe Reader.

Reproduce
Version: 25.2.4.3 (X86_64) / LibreOffice Community
Build ID: 33e196637044ead23f5c3226cde09b47731f7e27
CPU threads: 12; OS: Windows 11 X86_64 (10.0 build 26100); UI render: default; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL threaded

Not reproduce
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 23621ef302bf2e6a4dfae827ce83f31be2cd6056
CPU threads: 12; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL threaded
Comment 9 raal 2025-06-22 07:33:55 UTC
Tested with Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 09a1a5b8c8331437f88230f169bbb36cb83ed922
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded
and I can confirm that bug is gone. Closing.
Comment 10 forums.basil562 2025-06-22 18:24:54 UTC
Is version 26.2.0.0... available in dnf repository?