Bug 44729 - PDF import from Inkscape PDF export with opacity shows black background for each opaque object
Summary: PDF import from Inkscape PDF export with opacity shows black background for e...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
3.4.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:26.2.0
Keywords: filter:pdf
Depends on:
Blocks: PDF-Import-Draw PDF-Export
  Show dependency treegraph
 
Reported: 2012-01-12 09:21 UTC by mathog
Modified: 2025-08-09 15:58 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Test pdf, exported from Inkscape (13.10 KB, application/pdf)
2012-01-12 09:21 UTC, mathog
Details
Original SVG file, from which the PDF was created. (5.86 KB, image/svg+xml)
2012-01-12 09:23 UTC, mathog
Details
New opacity test (PDF) (2.93 KB, application/pdf)
2014-04-26 15:17 UTC, vvort
Details
New opacity test (SVG) (3.39 KB, image/svg)
2014-04-26 15:18 UTC, vvort
Details
opcacity import in LO 6.3.0.4 (57.60 KB, image/png)
2019-08-23 19:41 UTC, paulystefan
Details
import opacity svg in 6.3.0.4 and export to pdf (13.56 KB, application/pdf)
2019-08-23 19:43 UTC, paulystefan
Details
import opacity-test3 svg in 6.3.0.4 and export to pdf (3.25 KB, application/pdf)
2019-08-23 19:44 UTC, paulystefan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mathog 2012-01-12 09:21:44 UTC
Created attachment 55499 [details]
Test pdf, exported from Inkscape

PDF with opacity exported from Inkscape.  Looks OK in PDF viewers.  When LODraw imports there is a black rectangle the size of the entire drawing for each opaque object.  In this example there are 3 such rectangles.  Delete them and only two of the circles remain (not sure why).  This is with 3.4.4 release.
Comment 1 mathog 2012-01-12 09:23:05 UTC
Created attachment 55500 [details]
Original SVG file, from which the PDF was created.
Comment 2 mathog 2012-01-12 09:25:04 UTC
This is a specific problem peeled out of bug 43806
Comment 3 mathog 2012-01-12 09:29:22 UTC Comment hidden (obsolete)
Comment 4 mathog 2012-01-20 11:00:12 UTC Comment hidden (obsolete)
Comment 5 tester8 2012-01-20 13:59:11 UTC
Reproduced with

LOdev 3.5.0beta3
e40af8c-10029e3-615e522-88673a2-727f724
Ubuntu 10.04.3 x86
Linux 2.6.32-37-generic Russian UI
Comment 6 Buovjaga 2014-04-22 11:22:46 UTC
Confirmed on LO 4.2.3.3 / Win7 64-bit.
Comment 7 vvort 2014-04-26 15:17:17 UTC
Created attachment 98041 [details]
New opacity test (PDF)

To implement PDF opacity features correctly we need to support opacity value setting not only per-object, but also per-group.
Actually, we need masking, but per-group opacity will be good too.
For example, we have 3 circles drawn one on top of each other. Then opacity applied to this group.
Result will differ if we draw one circle with opacity, then draw second circle, then draw third one.
Here are examples in SVG and PDF.
Comment 8 vvort 2014-04-26 15:18:09 UTC
Created attachment 98042 [details]
New opacity test (SVG)
Comment 9 QA Administrators 2015-06-08 14:42:27 UTC Comment hidden (obsolete)
Comment 10 Heiko Tietze 2016-05-09 15:01:36 UTC
Confirmed

Version: 5.2.0.0.alpha0+
Build ID: 6b232aeecc55f1715bc111e636e36a8e24827efb
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-01-26_07:40:04
Locale: de-DE (de_DE)
Comment 11 QA Administrators 2017-10-30 08:31:36 UTC Comment hidden (obsolete)
Comment 12 paulystefan 2017-11-27 20:25:15 UTC Comment hidden (obsolete)
Comment 13 paulystefan 2018-08-23 12:55:44 UTC
some changes in view in 6.1.0.3 to previous version 6.0.x and before.

but bugs are present in svg and pdf.
Comment 14 paulystefan 2019-08-23 19:41:04 UTC
Created attachment 153607 [details]
opcacity import in LO 6.3.0.4

circles in window are not complete, but export to pdf is with full circle and ok
in LO 6.3.0.4
Comment 15 paulystefan 2019-08-23 19:43:09 UTC
Created attachment 153608 [details]
import opacity svg in 6.3.0.4 and export to pdf

opacity.svg in 6.3.0.4 pdf is now ok in export to pdf
Comment 16 paulystefan 2019-08-23 19:44:54 UTC
Created attachment 153609 [details]
import opacity-test3 svg in 6.3.0.4 and export to pdf

svg import of test3 to 6.3.0.4 and export to pdf is ok
Comment 17 paulystefan 2019-08-23 19:48:31 UTC
color in opacity-test3.svg import in 6.3.0.4 and in pdf is not same like in acro reader and firefox
Comment 18 QA Administrators 2021-08-23 03:51:35 UTC Comment hidden (obsolete)
Comment 19 Timur 2021-08-23 07:08:13 UTC
Repro 7.3+.
Comment 20 QA Administrators 2023-08-24 03:14:24 UTC Comment hidden (obsolete)
Comment 21 Dave Gilbert 2024-09-09 00:47:48 UTC
Essentially an opacity subtest from tdf#43806
Comment 22 Dave Gilbert 2025-07-22 13:48:30 UTC
As per comment 7, this is using PDFs transparency group feature, which is all very complex; but in this case we've got two symptoms:
   a) The colour of the overlayed circles
   b) The big black square

My reading of the PDF code is that it:
  1) Sets up a graphics state by rendering a 50% black full size rectangle as a softmask - that mask is marked with /S /Alpha - which means it should only ever influence the alpha value.  This is marked as a transparency group at one level

  2) It then sets the current colour to a pattern consisting of the filled/stroked circle - that's non-transparent; then does a rectangle that happens to be filled with that pattern of the circle - which seems crazy complex.

But somehow this pair marked as transparency groups is supposed to come together as the transparent circles.
But the symptom (b) of the big black square is I think a screwup in (1) - where the creation of that softmask shouldn't do anything except change transparency; so perhaps we can cure (b) without fully fixing the group setup.
Comment 23 Commit Notification 2025-08-09 13:00:42 UTC
Dr. David Alan Gilbert committed a patch related to this issue.
It has been pushed to "master":

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

tdf#44729 sdext,pdfimport: Pass begin/end Transparency Group

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 24 Commit Notification 2025-08-09 13:00:44 UTC
Dr. David Alan Gilbert committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/56d8b1a916d82df3a8ad32ed4c8f65c3b8c78d45

tdf#44729 sdext,pdfimport: Route transparency group down

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 25 Commit Notification 2025-08-09 13:55:01 UTC
Dr. David Alan Gilbert committed a patch related to this issue.
It has been pushed to "master":

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

tdf#44729 sdext,pdfimport: Add Group elements

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 26 Commit Notification 2025-08-09 13:56:04 UTC
Dr. David Alan Gilbert committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/2383fae366c787bc6e08cf5439521674d52fd8c1

tdf#44729 sdext,pdfimport: Hide transparency groups 'for soft mask'

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 27 Dave Gilbert 2025-08-09 15:58:33 UTC
The black backgrounds are now gone with the patch I've just put in.
That patch:
  a) Hides the rendering of soft masks (which should never have been directly visible)
  b) Stores a 'group' node marked as transparency - we don't yet do anything with that node to actually get any transparency.

Anyway, given the blackness has gone, I'll close this one, and we can follow more on 43806.