Bug 165853 - Incorrect import pdf with image fill shape
Summary: Incorrect import pdf with image fill shape
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
25.2.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:pdf
Depends on:
Blocks: 86211
  Show dependency treegraph
 
Reported: 2025-03-21 13:41 UTC by zllangty
Modified: 2025-03-23 10:29 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
import pdf display incorrect (242.34 KB, image/png)
2025-03-21 13:43 UTC, zllangty
Details
example pdf (20.18 KB, application/pdf)
2025-03-21 13:43 UTC, zllangty
Details
source Writer ODT for 199945 (198.09 KB, application/vnd.oasis.opendocument.text)
2025-03-23 01:17 UTC, zllangty
Details
Fix tiling image shape import (4.15 KB, patch)
2025-03-23 02:04 UTC, zllangty
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zllangty 2025-03-21 13:41:15 UTC
Description:
When import pdf file with image fill shape, the image may overflow and display incorrect

Steps to Reproduce:
1.Use writer create new file and insert a rectangle
2.Fill the rectangle area with pattern or image
3.Export to pdf file
4.Open pdf with Draw and observe

Actual Results:
The image shown outside of the shape area.

Expected Results:
The image should tile correct and inside the area


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 25.2.1.2 (X86_64) / LibreOffice Community
Build ID: d3abf4aee5fd705e4a92bba33a32f40bc4e56f49
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: en-US
Calc: CL threaded
Comment 1 zllangty 2025-03-21 13:43:18 UTC
Created attachment 199944 [details]
import pdf  display incorrect
Comment 2 zllangty 2025-03-21 13:43:48 UTC
Created attachment 199945 [details]
example pdf
Comment 3 V Stuart Foote 2025-03-21 14:58:18 UTC
Hmm, confirmed thanks. 

Interesting test PDF,  a clipping mask issue. Duplicate of bug 86211?

No improvements with recent PDF filter effort in 2025-03-19 master against 25.8.0

Note: the Insert -> Image (pdfium based filter) does handle the clip mask correctly in LibreOffice if that supports your work flow working with PDF pages.


=-testing-=

Version: 25.2.1.2 (X86_64) / LibreOffice Community
Build ID: d3abf4aee5fd705e4a92bba33a32f40bc4e56f49
CPU threads: 28; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded

Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 4957d832c76598e78a57324dad5b4de7345a33e2
CPU threads: 28; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL threaded
Comment 4 zllangty 2025-03-22 02:02:53 UTC
It's another clip issue, it caused by pdfimport convert the shape to a clip path and a series draw image. But the PDFIProcessor didn't handle the clip path correctly.
I have not find way can clip the ImageElement.
And it's seems tilingPatternFill can clip it, I need more test if we use tillingPatternFill for all draw image.
Comment 5 Dave Gilbert 2025-03-22 19:04:47 UTC
Yeh that doesn't surprise me too much; there's very little clipping code in there; until a few months ago there was almost no clipping;  I added simple line and fill clipping a while ago.
Could you attach the Libreoffice file you used to create the PDF?
I'm curious what the primitives inside that look like, then we'll know what we need to get the PDF importer to generate.
Comment 6 V Stuart Foote 2025-03-22 21:09:23 UTC
@zllangty, Needinfo is back to you. Would you please attach the source Writer ODF document you used to generated attachment 199945 [details]

Thank you!
Comment 7 zllangty 2025-03-23 01:17:48 UTC
Created attachment 199967 [details]
source Writer ODT for 199945

It just a normal rectangle
Comment 8 Dave Gilbert 2025-03-23 01:23:54 UTC
Right that makes sense
Comment 9 zllangty 2025-03-23 02:04:48 UTC
Created attachment 199968 [details]
Fix tiling image shape import

I made a patch, use tillingPatternFill when the image need be clip.
That make sure the image always inside the shape.
But it a little bit dirty.
May we should merge these drawImage and use tiling fill a path.