Bug 159308 - DOCX created with Google Docs with hyperlinked image loses URL at import
Summary: DOCX created with Google Docs with hyperlinked image loses URL at import
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: dataLoss, filter:docx
Depends on:
Blocks: DOCX-Hyperlink
  Show dependency treegraph
 
Reported: 2024-01-21 09:58 UTC by Darya
Modified: 2024-03-11 07:26 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Docs file with picture with a link (25.43 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-01-21 10:02 UTC, Darya
Details
Docs file that I saved using save as pdf - link works (10.34 KB, application/pdf)
2024-01-21 10:05 UTC, Darya
Details
Docs file converted to pdf using soffice (11.87 KB, application/pdf)
2024-01-21 10:05 UTC, Darya
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Darya 2024-01-21 09:58:28 UTC
Description:
I am using bash command "soffice -convert-to pdf" to convert my Docs file to pdf. 
I put a picture in a file and adding hyperlink to the picture (the picture is clickable).
After converting the file to pdf using soffice, the hyperlinks on the pictures are broken. The picture is not clickable anymore. 

Steps to Reproduce:
1. Create a Word file with a picture inside it. (name a file my_file.docx)
2. Add hyper link to the picture.
3. Run: soffice --headless env:UserInstallation=file:///tmp/convertfile/.config --convert-to pdf ./my_file.docx

Actual Results:
If you open the pdf file, the picture is not clickable. The hyperlink is broken.

Expected Results:
The picture in the pdf file should be clickable. (It works if I save the file as PDF from the Microsoft Word application on my computer). 


Reproducible: Always


User Profile Reset: No

Additional Info:
Tried to reproduce on Word and Excel files.
It happens with Excel files as well as Docs. 
It happens in mac-os and linux (amd64).
Comment 1 Darya 2024-01-21 10:02:08 UTC
Created attachment 192084 [details]
Docs file with picture with a link
Comment 2 Darya 2024-01-21 10:05:00 UTC
Created attachment 192085 [details]
Docs file that I saved using save as pdf - link works
Comment 3 Darya 2024-01-21 10:05:39 UTC
Created attachment 192086 [details]
Docs file converted to pdf using soffice
Comment 4 Darya 2024-01-21 10:06:32 UTC
Docs file converted to pdf using soffice - the link is broken.
Comment 6 Darya 2024-01-29 09:27:14 UTC
Hi, I tried: 

soffice --headless env:UserInstallation=file:///tmp/convertfile/.config --convert-to pdf:draw_pdf_Export:ExportBookmarksToPDFDestination=true ./Link.docx

and I tried all the flags: 
ExportBookmarksToPDFDestination
ExportLinksRelativeFsys
ConvertOOoTargetToPDFTarget
PDFViewSelection

But the issue is still happening. The picture is not clickable in the pdf.
Comment 7 Darya 2024-02-08 14:41:37 UTC
Hi, any updates on this bug?
Comment 8 Stéphane Guillou (stragu) 2024-03-06 23:12:10 UTC
Thanks for the report, Darya.
Please do not set you own report as "new", as another contributor needs to confirm the issue.

Note that the DOCX sample you attached does _not_ have a hyperlink on the image. I had to add it to test.

I tested with:
1. Open you sample DOCX attachment 192084 [details]
2. right-click on image > Properties > Hyperlink > filled URL field with https://whatcanidoforlibreoffice.org > OK
3. Export to PDF, both with command line and GUI.

The link works. File opened with Evince and Firefox.

Tested with:

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 9574a62add8e4901405e12117e75c86c2d2c2f21
CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: CL threaded

Can you please:
- test again, making sure the image does have a hyperlink in LibreOffice
- open the file with different PDF viewers
- give us more precise steps / a new file sample if you can still reproduce
Comment 9 Darya 2024-03-07 09:36:47 UTC
Hi, 
I re-downloaded the "Docs file with picture with a link" file, and the picture is clickable. When I open it with Microsoft Docs on mac and press the link, the https://www.paloaltonetworks.com/ link is opened. After converting the file using libreoffice tool, the picture in the pdf file is not clickable.
Comment 10 Stéphane Guillou (stragu) 2024-03-07 12:05:27 UTC
Right, I can see the link in Google Docs, and downloading at PDF keeps the link.
In online Office 365, the link is shown next to the image, and not exported to PDF either.
In LibreOffice, I tested as far as 5.0 and I could never see a link on the image in the DOCX attachment.

Just to clarify:
- when you say "the picture is clickable", you mean in MS Office desktop, right? When you open the DOCX in LibreOffice, the picture is not clickable, and the URL field is empty? In which case it would be a DOCX filter issue.
- your second attachment ("Docs file that I saved using save as pdf - link works") was exported with MS Office?
Comment 11 Darya 2024-03-07 13:24:53 UTC
Answers: 
1. when you say "the picture is clickable", you mean in MS Office desktop, right? When you open the DOCX in LibreOffice, the picture is not clickable, and the URL field is empty? In which case it would be a DOCX filter issue.

Yes, I open the file using MS Office Docx on my mac and the picture is clickable there. 
I did not try to open the file using libre office.

- your second attachment ("Docs file that I saved using save as pdf - link works") was exported with MS Office?

Yes, I used MS Office Docx on my mac and did: File->Save As -> PDF. The links on the saved pdf file worked.
Comment 12 Stéphane Guillou (stragu) 2024-03-07 16:25:01 UTC
Thanks for clarifying.
So the issue is that a hyperlinked image is not imported properly.
Same in OOo 3.3 -> inherited.

How was the file created?
Comment 13 Darya 2024-03-10 11:52:15 UTC
I created a file using Google Docs.
Comment 14 Stéphane Guillou (stragu) 2024-03-11 07:25:59 UTC
I tested with my own file created in Google Docs, one picture hyperlinked.
Exported DOCX has in word/document.xml:

<w:hyperlink r:id="rId6">
   <w:r w:rsidDel="00000000" w:rsidR="00000000" w:rsidRPr="00000000">
      <w:rPr><w:color w:val="1155cc"/><w:u w:val="single"/></w:rPr>
      <w:drawing>
         <wp:inline distB="114300" distT="114300" distL="114300" distR="114300">
            <wp:extent cx="5731200" cy="3835400"/>
            <wp:effectExtent b="0" l="0" r="0" t="0"/>
            <wp:docPr id="1" name="image1.jpg"/>
            <a:graphic>
               <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic><pic:nvPicPr><pic:cNvPr id="0" name="image1.jpg"/><pic:cNvPicPr preferRelativeResize="0"/></pic:nvPicPr><pic:blipFill><a:blip r:embed="rId7"/><a:srcRect b="0" l="0" r="0" t="0"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="5731200" cy="3835400"/></a:xfrm><a:prstGeom prst="rect"/><a:ln/></pic:spPr></pic:pic></a:graphicData>
            </a:graphic>
         </wp:inline>
      </w:drawing>
   </w:r>
</w:hyperlink>

The target for the hyperlink is in word/_rels/document.xml.rels:

<Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" Target="https://bugs.documentfoundation.org/show_bug.cgi?id=159308" TargetMode="External"/>

(Note that an export of the same Google Docs file to ODT also loses the hyperlink)