Bug 142133 - Hyperlinks cannot be clicked / interacted with in PDF export of RTF or DOCX files (comment 9)
Summary: Hyperlinks cannot be clicked / interacted with in PDF export of RTF or DOCX f...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
6.3.4.2 release
Hardware: All All
: high normal
Assignee: Xisco Faulí
URL:
Whiteboard: target:24.8.0 target:24.2.3 target:7.6.7
Keywords: bibisected, bisected, filter:docx, filter:rtf, regression
: 148567 150793 154760 (view as bug list)
Depends on:
Blocks: PDF-Export Hyperlink
  Show dependency treegraph
 
Reported: 2021-05-06 16:43 UTC by marin.ionut86
Modified: 2024-03-19 17:49 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Attachments
Rtf file with links that break when converted to pdf (11.02 KB, application/rtf)
2022-03-16 10:19 UTC, Tonobiarmin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description marin.ionut86 2021-05-06 16:43:03 UTC
Description:
Hello,

    Currently: saving a .docx/.odt document (containing web links (https://...) and text) as a a .rtf document preserves the links fine (they can be opened with CTRL + Click);
    The bug: Further: exporting the saved .rtf document to a .pdf document: exports it only as text (the web links (in the exported pdf) cannot be opened)

Thank you in advance


Steps to Reproduce:
1. Save a .docx/.odt document (containing web links (https://...) and text) as a a .rtf document
2. Export the saved .rtf document to a .pdf document

Actual Results:
The bug: The web links are saved in the .pdf only as text (only the anchor texts (labels) of the web links show up (as text) and the links cannot be opened (the URLs seem to be missing))

Expected Results:
It should be possible to open web links in the .pdf 


Reproducible: Always


User Profile Reset: No



Additional Info:
LibreOffice Writer should also export correctly .rtf to .pdf, not only: .docx, .odt, ...
Comment 1 Harshita Nag 2021-05-07 05:05:26 UTC
Can't reproduce this bug in my system.

ADDITIONAL INFO:
Version: 6.4.7.2
Build ID: 639b8ac485750d5696d7590a72ef1b496725cfb5
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: gtk3; 
Locale: en-IN (en_IN); UI-Language: en-US
Calc: threaded
Comment 2 Jean-Baptiste Faure 2021-08-11 17:27:59 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2022-02-08 03:50:21 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2022-03-11 03:52:58 UTC Comment hidden (obsolete)
Comment 5 Tonobiarmin 2022-03-16 10:17:22 UTC
I would like to put attention to this issue as I have tried to a convert a number of .rtf files to .pdf with hyperlinks included and have run into similar issues.

Operating systems tried:
- Windows 10
- Ubuntu 20.04

Libreoffice versions:
- 6.4.7.2
- 7.3.1.3

To reproduce on Ubuntu:
1. Create .rtf file and add a link to e.g. https://www.google.com/
2. Reload the .rtf or restart libreoffice and open the .rtf again.
3. Convert the file to .pdf.
4. Try to open the links in the .pdf file.


To reproduce on Windows:
1. Create .rtf file and add a link to e.g. https://www.google.com/
Make sure the 'Text' for the link is just regular words. Not formatted like a URL link. E.g. should not contain 'www.'

2. Reload the .rtf or restart libreoffice and open the .rtf again.
3. Convert the file to .pdf.
4. Try to open the links in the .pdf file.


Ubuntu additional notes:
The link conversion works while the file is being written to, but breaks as soon as the document is closed or reopened. 

Windows additional notes:
Windows requires the 'Text' field of the link to have a URL format.
E.g. if the 'Text' is 'www.google.com' it will convert correctly.
If the 'Text' is 'google' it will break.


Attaching a test file where all of the links refuse to convert on Ubuntu and only some(Those with URL formatted text) convert on windows.
Comment 6 Tonobiarmin 2022-03-16 10:19:49 UTC
Created attachment 178911 [details]
Rtf file with links that break when converted to pdf

On Ubuntu all the links refuse to convert correctly when going from .rtf to .pdf(They are not recognized as links)

On Windows the links with text in a URL format(e.g. www.google.com) convert correctly, the others break.
Comment 7 Jean-Baptiste Faure 2022-03-16 15:58:30 UTC
Thank you for the test file.

Reproducible under Ubuntu with LO 7.3.3.0.0+
Additionally, converting the RTF file back to ODT and exporting this ODT to PDF does not solve the problem, hyperlinks in the PDF are still not functional.

Set as NEW.

Best regards. JBF
Comment 8 Alexander Salykin 2022-04-18 18:33:52 UTC Comment hidden (obsolete)
Comment 9 Stéphane Guillou (stragu) 2024-03-07 13:29:23 UTC
I tested with the linux-64-releases bibisect repo, **making sure to delete the user profile or use safe mode** as it looks like some settings were getting carried over, messing up the bisection. (This is what might have happened in Alexander's results in comment 8.)

Result are the same with the command line or the GUI, exporting attachment 178911 [details] to PDF.
- libreoffice-6.3.3.2 is unaffected;
- libreoffice-6.3.4.1 is the first version that lost the hyperlinks in the PDF export. (Tested opening the PDF in Okular, Evince and Firefox.)

Bibisected with linux-64-6.3 repo to first bad build [f0295252e29f35bd88a5e38d0c43788579cc6321] which points to core commit ccb38977541c304ff08ebe1a1b24c512ab670acf, a cherrypick of:

commit 576611895e51186d38ddefa10ed8d66075d9de37
author	Tünde Tóth 	Tue Oct 08 13:58:44 2019 +0200
committer	László Németh 	Sat Oct 12 10:00:20 2019 +0200
tdf#127741 DOCX import: format hyperlink with Default character style
Reviewed-on: https://gerrit.libreoffice.org/80449

Same commit as in bug 148567, bug 150793 and bug 154760, let's consolidate.
Comment 10 Stéphane Guillou (stragu) 2024-03-07 13:30:52 UTC
*** Bug 148567 has been marked as a duplicate of this bug. ***
Comment 11 Stéphane Guillou (stragu) 2024-03-07 13:32:05 UTC
*** Bug 150793 has been marked as a duplicate of this bug. ***
Comment 12 Stéphane Guillou (stragu) 2024-03-07 13:32:32 UTC
*** Bug 154760 has been marked as a duplicate of this bug. ***
Comment 13 Xisco Faulí 2024-03-08 11:15:09 UTC
Using attachment 186584 [details] from bug 154760
The pdf should have

% PDFWriterImpl::emitLinkAnnotations
8 0 obj
<</Type/Annot/Subtype/Link/Border[0 0 0]/Rect[71.993 706.55 103.907 720]/Contents<FEFF00420072006F006B0065006E>/A<</Type/Action/S/URI/URI(https://google.com/)>>
/StructParent 1>>
endobj

but it doesn't.
vcl::PDFWriter::CreateLink in /home/xisco/libreoffice/vcl/source/gdi/pdfwriter.cxx is never called
Comment 14 Xisco Faulí 2024-03-08 11:30:59 UTC
SwGetINetAttrs in sw/source/core/text/EnhancedPDFExportHelper.cxx is empty
Comment 15 Commit Notification 2024-03-08 20:09:54 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

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

tdf#142133: partially revert 576611895e5

It will be available in 24.8.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 16 Stéphane Guillou (stragu) 2024-03-12 11:44:51 UTC
Thank you Xisco! I verified the fix with 5 of the samples attached to this report and its duplicates, all works well.

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f42363c51672a5b3685b0b9b11e932680530dce3
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
Comment 17 Commit Notification 2024-03-12 12:57:11 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

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

tdf#142133: partially revert 576611895e5

It will be available in 24.2.3.

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 18 Commit Notification 2024-03-19 17:49:21 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/5f025f9bab12d0f08c23cca08d12c15cca95e9ed

tdf#142133: partially revert 576611895e5

It will be available in 7.6.7.

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.