Bug 44731 - PDF import problems with gradients and patterns
Summary: PDF import problems with gradients and patterns
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
(earliest affected)
3.4.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
Whiteboard: Confirmed: Confirmed:4.4.3...
: 54924 (view as bug list)
Depends on: 86211
Blocks: PDF-Import-Draw
  Show dependency treegraph
Reported: 2012-01-12 09:34 UTC by mathog
Modified: 2024-02-29 13:32 UTC (History)
12 users (show)

See Also:
Crash report or crash signature:

Problem PDF (16.12 KB, application/pdf)
2012-01-12 09:34 UTC, mathog
source SVG for the problem PDF (13.61 KB, image/svg+xml)
2012-01-12 09:34 UTC, mathog
Screen shot of LODraw after opening the problem PDF (20.99 KB, image/png)
2012-01-12 09:35 UTC, mathog
New gradient test (PDF) (2.93 KB, application/pdf)
2014-04-26 14:52 UTC, vvort
New gradient test (SVG) (4.97 KB, image/svg)
2014-04-26 14:52 UTC, vvort
Clipping patch (experimental) (2.39 KB, patch)
2014-04-26 15:05 UTC, vvort
test 4 in LOO 64 bit (39.90 KB, image/png)
2017-09-01 21:06 UTC, paulystefan
gradient-svg test LOO- (18.11 KB, image/png)
2017-09-01 21:18 UTC, paulystefan
gradient-svg-inkscape-0.92.2-64bit screenshot (24.06 KB, image/png)
2017-09-01 21:32 UTC, paulystefan
source svg in firefox 52.3 screenshot (11.72 KB, image/png)
2017-09-01 21:36 UTC, paulystefan
gradient-svg-scribus-1.5.3-64bit-test screenshot (76.76 KB, image/png)
2017-09-01 21:57 UTC, paulystefan
gradient-test4-acrobatreader-screenshot (84.71 KB, image/png)
2017-09-01 22:05 UTC, paulystefan
gradient-pdf-acrobatreader-screenshot (41.90 KB, image/png)
2017-09-01 22:06 UTC, paulystefan
gradient-svg-inkscape-0.92.2-64bit-test2 (17.27 KB, image/png)
2017-09-01 22:08 UTC, paulystefan
import gradient.svg in Lo and export pdf (78.87 KB, application/pdf)
2019-08-23 20:09 UTC, paulystefan

Note You need to log in before you can comment on or make changes to this bug.
Description mathog 2012-01-12 09:34:18 UTC
Created attachment 55501 [details]
Problem PDF

Example PDF made by save as from Inkscape.  Looks fine in PDF viewers.  In LODraw
the gradient/pattern extends to the limits of the image.  3.5.0b2 does exactly the same thing.

This is a specific issue extracted from bug 43806
Comment 1 mathog 2012-01-12 09:34:53 UTC
Created attachment 55502 [details]
source SVG for the problem PDF
Comment 2 mathog 2012-01-12 09:35:39 UTC
Created attachment 55503 [details]
Screen shot of LODraw after opening the problem PDF
Comment 3 mathog 2012-01-20 11:01:32 UTC
Problem is unchanged in 3.5.0rc1 on Windows
Comment 4 tester8 2012-01-20 14:04:01 UTC
Reproduced with

LOdev 3.5.0beta3
Ubuntu 10.04.3 x86
Linux 2.6.32-37-generic Russian UI
Comment 5 retired 2014-01-21 10:36:28 UTC

OS > All
Comment 6 vvort 2014-04-26 14:52:03 UTC
Created attachment 98038 [details]
New gradient test (PDF)

Two types of bugs are mixed in provided test PDF (gradient.pdf): clipping and opacity.
Here is the new test files: gradient_test4.svg and gradient_test4.pdf
They are free from opacity bugs (and from big black rectangles as well).
Comment 7 vvort 2014-04-26 14:52:43 UTC
Created attachment 98039 [details]
New gradient test (SVG)
Comment 8 vvort 2014-04-26 15:05:58 UTC
Created attachment 98040 [details]
Clipping patch (experimental)

Clipping must be performed without modifying of source objects.
But there is no such feature in LibreOffice Draw.
I have tried to implement modifying clipping.
But I was faced with two problems:
1. Radial gradients rendered by poppler as 256 polygons with 400 points.
That is bad for performance, but when clip is applied, situation becomes even worse.
2. Function basegfx::tools::clipPolyPolygonOnPolyPolygon() behaves badly in border cases. With my test file it fails 2 times: with radial gradient clipping and with pattern fill clipping.
Here is my experimental patch file.
Maybe it will be useful for someone.
Comment 9 vvort 2014-11-12 16:17:44 UTC
Bug 86211 contains newer version of clipping patch
Comment 10 Asher 2015-07-02 00:39:37 UTC
Confirmed: Linux IA64
Black area shouldn't show up.
Comment 11 Robinson Tryon (qubit) 2015-07-15 17:29:20 UTC Comment hidden (obsolete)
Comment 12 Heiko Tietze 2016-05-09 15:12:42 UTC

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 13 Heiko Tietze 2016-05-10 12:30:20 UTC
*** Bug 54924 has been marked as a duplicate of this bug. ***
Comment 14 kitaets 2016-05-20 12:32:06 UTC
Is it really PDF import to LO Draw or may be PDF export? Could somebody please explain the bug step by step as in Bug 54924 which has been marked as duplicate?
Comment 15 Heiko Tietze 2016-05-22 07:35:13 UTC
(In reply to kitaets from comment #14)
> Is it really PDF import to LO Draw or may be PDF export? 

When I create a rectangle in Draw, fill it with a gradient from black to white, export to pdf and reopen the pdf, the object is rasterized (same as for svg in tdf#64464). Looking into the raw pdf file there is nothing obviously wrong.

I'm not saying the export filter has no bugs, but do we really need two tickets? Having a large list to go through might be discouraging. Anyway, feel free to reactivate the duplicate if you think it's necessary (in this case set blocks 99746 and see as well 44731 please).
Comment 16 paulystefan 2017-09-01 21:06:41 UTC
Created attachment 135945 [details]
test 4 in LOO 64 bit

same in 

white sheet, right circles, wrong lines outside the circles
Comment 17 paulystefan 2017-09-01 21:11:05 UTC
problem pdf

black sheet in windows 10 64bit

Version: (x64)
Build-ID: 7556cbc6811c9d992f4064ab9287069087d7f62c
CPU-Threads: 4; Betriebssystem:Windows 6.19; UI-Render: GL; 
Gebietsschema: de-DE (de_DE); Calc: CL


Version: (x64)
Build-ID: 50d9bf2b0a79cdb85a3814b592608037a682059d
CPU-Threads: 4; Betriebssystem:Windows 6.19; UI-Render: Standard; Layout Engine: new; 
Gebietsschema: de-DE (de_DE); Calc: group
Comment 18 paulystefan 2017-09-01 21:18:19 UTC
Created attachment 135946 [details]
gradient-svg test LOO-

problem in last circle gradient
Comment 19 paulystefan 2017-09-01 21:30:24 UTC
test in 

wrong direction of second gradient

third gradient not white near circle line.

4th circle is black full inside  and a  greater rectangle black in addition
Comment 20 paulystefan 2017-09-01 21:32:27 UTC
Created attachment 135948 [details]
gradient-svg-inkscape-0.92.2-64bit screenshot

4th circle gradient with more lines in inkscape 0.92.2
Comment 21 paulystefan 2017-09-01 21:36:36 UTC
Created attachment 135949 [details]
source svg in firefox 52.3 screenshot

less lines in 4th circle.
Comment 22 paulystefan 2017-09-01 21:42:55 UTC
Comment on attachment 135948 [details]
gradient-svg-inkscape-0.92.2-64bit screenshot

more lines in 4th circle not reproducable
Comment 23 paulystefan 2017-09-01 21:57:28 UTC
Created attachment 135951 [details]
gradient-svg-scribus-1.5.3-64bit-test screenshot

scribus 1.5.3 also with problem in 4th circle by gradient.svg
Comment 24 paulystefan 2017-09-01 22:05:30 UTC
Created attachment 135952 [details]

more lines in 4th circle
Comment 25 paulystefan 2017-09-01 22:06:33 UTC
Created attachment 135953 [details]

all right like svg
Comment 26 paulystefan 2017-09-01 22:08:36 UTC
Created attachment 135954 [details]

all right like svg in Firefox
Comment 27 paulystefan 2017-09-01 22:17:13 UTC
Comment on attachment 135949 [details]
source svg in firefox 52.3 screenshot

all ok, not less or more lines
Comment 28 paulystefan 2017-11-27 20:17:52 UTC 64 bit win10

same like, no improvement or change.
Comment 29 Roman Kuznetsov 2018-06-23 11:23:24 UTC
in LO Draw 6.1 beta 2

Problem PDF opens with black background and wrong gradients


Source SVG from Problem PDF opens very fine 

still repro
Comment 30 V Stuart Foote 2018-06-23 16:01:29 UTC
For 6.2 the pdfium based filter is now handling both import and insert, and the pdfium rendering to bitmap on canvas correctly renders the linear, radial and pattern fills of attachment 55501 [details] or attachment 98038 [details]

But break of the inserted PDF, or Import (e.g. opening) of the PDF with PDFium, is not handling clip of the gradient fills well.

Should this and similar import/break bugs be closed and restated against the new PDFium filter? 

@Miklos, Ashod, Kendy
Comment 31 Miklos Vajna 2018-06-25 06:35:16 UTC
I would let Ashod / Kendy decide when the pdfium import is ready to replace the poppler one.
Comment 32 paulystefan 2018-08-23 13:00:28 UTC
svg import  improved but not perfect in LO

black circles incomplete.

pdf-import same buggy like before.
Comment 33 paulystefan 2018-08-23 13:01:37 UTC
blue circles incomplete not black
Comment 34 paulystefan 2019-08-23 20:03:03 UTC
svg import in circles are incomplete, but in export pdf all is ok.
so nearly 50% is here ok. 

import of problem pdfs are nearly like bugs 43806 and 44729
Comment 35 paulystefan 2019-08-23 20:03:34 UTC Comment hidden (obsolete)
Comment 36 paulystefan 2019-08-23 20:09:01 UTC
Created attachment 153612 [details]
import gradient.svg in Lo and export pdf

svg import to LO circles are incomplete.
but pdf export the circles are ok and the result is perfect in my view.

so svg import with pdf export is ok.

problem pdf import failed like before in 5.x and 6.x
Comment 37 QA Administrators 2021-08-23 03:51:41 UTC Comment hidden (obsolete)
Comment 38 Xavier R 2022-09-08 12:09:41 UTC
Always here with LibO x64 and x86, both on Win 11

Version: (x64) / LibreOffice Community
Build ID: 8d71d29d553c0f7dcbfa38fbfda25ee34cce99a2
CPU threads: 12; OS: Windows 10.0 Build 22000; UI render: Skia/Vulkan; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: CL

Version: (x86) / LibreOffice Community
Build ID: 184fe81b8c8c30d8b5082578aee2fed2ea847c01
CPU threads: 12; OS: Windows 10.0 Build 22000; UI render: Skia/Vulkan; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: CL

I change Hardware -> All
Comment 39 Dave Gilbert 2024-02-29 13:32:43 UTC
FYI this is separate from the 113050 bug I just fixed.