Bug 135002 - FILESAVE PDF Embedded and cropped PDF is incorrectly exported to PDF
Summary: FILESAVE PDF Embedded and cropped PDF is incorrectly exported to PDF
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
5.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: implementationError
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
 
Reported: 2020-07-21 07:00 UTC by NISZ LibreOffice Team
Modified: 2024-04-02 09:07 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example document with embedded PDF (142.83 KB, application/vnd.oasis.opendocument.text)
2020-07-21 07:00 UTC, NISZ LibreOffice Team
Details
Example PDF image to embed (100.11 KB, application/pdf)
2020-07-21 07:00 UTC, NISZ LibreOffice Team
Details
The exported version of the document (96.05 KB, application/pdf)
2020-07-21 07:01 UTC, NISZ LibreOffice Team
Details
The document exported using reference XObject option (130.95 KB, application/pdf)
2020-07-21 07:01 UTC, NISZ LibreOffice Team
Details
The document opened in 5.3, shows the larger image uncropped in the editor (95.60 KB, image/png)
2020-07-21 07:02 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description NISZ LibreOffice Team 2020-07-21 07:00:14 UTC
Created attachment 163342 [details]
Example document with embedded PDF

Attached user made (in 6.3) document contains an image embedded in the header that was originally a PDF file. 
This file contains a larger image that is cropped to show a smaller, relevant portion of the image.
Upon exporting the whole document to PDF the image from the PDF is incorrectly cropped and a different portion of the larger image is visible.

Steps to reproduce:
1.	Open attached file
2.	Go to the header and select Insert - Image
3.	Insert the attached PDF file as image
4.	Export the document to PDF

Actual results:
The exported PDF shows a grey box with text “II. AZ EMBLÉMA SZÍNE”

Expected results:
Exported PDF contains the image cropped the same way as in the editor.

LibreOffice details:
Version: 7.1.0.0.alpha0+ (x64)
Build ID: a3e52f63c92876b4a3ac6df61e05b1d3510ba9c9
CPU szálak: 4; OS: Windows 6.3 Build 9600; Felületmegjelenítés: alapértelmezett; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: CL

Also happens in
Version: 5.4.0.3
Build ID: 92c2794a7c181ba4c1c5053618179937228ed1fb
CPU threads: 4; OS: Windows 6.2; UI render: GL; 
Locale: en-US (hu_HU); Calc: CL

In 5.3 the PDF was not imported cropped in the editor.
In 5.2 and older the export looked correct, although probably because of the placeholder PNG which is also saved.

Additional Information: 

Bibisected the current state using bibisect-win32-5.4 to: 
URL: https://cgit.freedesktop.org/libreoffice/core/commit/?id=242a9b634213acf03cabc373928555dc81afc672 
author	Miklos Vajna <vmiklos@collabora.co.uk>	2017-04-05 15:35:13 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2017-04-05 19:07:32 +0200

tdf#106972 vcl PDF export, PDF images: handle indirect font references

Right before this there was only an empty space exported… but before this commit:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=9c944b0d1bff9a0ab1b7e8454c9ac5e7194aa533
author	Miklos Vajna <vmiklos@collabora.co.uk>	2017-03-29 09:47:09 +0200
committer	Miklos Vajna <vmiklos@collabora.co.uk>	2017-03-29 08:46:52 +0000

vcl PDF export, norefxobj: add UI for this

The correct image (or PDF?) was exported. With current master turning ON the “Use reference XObjects” option on the PDF Export dialog also creates this expected result.

Adding CC to: Miklos Vajna - not necessarily regression, but perhaps an improvement opportunity for the new PDF export method :)
Comment 1 NISZ LibreOffice Team 2020-07-21 07:00:39 UTC
Created attachment 163343 [details]
Example PDF image to embed
Comment 2 NISZ LibreOffice Team 2020-07-21 07:01:13 UTC
Created attachment 163344 [details]
The exported version of the document
Comment 3 NISZ LibreOffice Team 2020-07-21 07:01:37 UTC
Created attachment 163345 [details]
The document exported using reference XObject option
Comment 4 NISZ LibreOffice Team 2020-07-21 07:02:02 UTC
Created attachment 163346 [details]
The document opened in 5.3, shows the larger image uncropped in the editor
Comment 5 Miklos Vajna 2020-07-21 07:27:14 UTC
Code pointers: if the general "copy objects from pdf image to pdf result" code is broken, then this should be fixed in vcl/source/gdi/pdfobjectcopier.cxx.

If we fail to copy some metadata over from the original pdf image into the pdf result, then this would be in vcl/source/gdi/pdfwriter_impl.cxx, search for "The original page was rotated", that's how rotation is handled.
Comment 6 Timur 2022-01-25 10:23:39 UTC
*** Bug 146895 has been marked as a duplicate of this bug. ***
Comment 7 Jörn Schwarz 2022-01-25 15:22:10 UTC
I disagree.
the bug described here goes back to the imported pdf file, which contains many more graphical objects than it displays and which are hidden.
If you open the file "BAZ-KH.pdf" with LO-Draw, you can see the additional objects.
In this respect this bug is not a bug at all.
So bug 146895 should  should remain.
Comment 8 QA Administrators 2024-01-26 03:14:24 UTC
Dear NISZ LibreOffice Team,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug