Bug 142707 - PDF: Export to PDF of relative hyperlinks created by function HYPERLINK() not plausible
Summary: PDF: Export to PDF of relative hyperlinks created by function HYPERLINK() not...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.1.2.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-07 21:42 UTC by Norbert Scheibner
Modified: 2025-05-19 04:17 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Calc document with the test cases (20.12 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-06-07 21:58 UTC, Norbert Scheibner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Norbert Scheibner 2021-06-07 21:42:45 UTC
Description:
Relative paths to a subdir are not exported correct to a pdf. There happens a lot of unwanted and untested string conversion I think.


Steps to Reproduce:
Export relative path in PDF export dialog.
Create directory "subdir" on "d:\".
Use a working pdf as target.
Copy the pdf to "D:\subdir\"
Rename it to "file.pdf"
Create a calc document in "D:\".

Now we want a relative path to the pdf in the subdir.

Case A:
=HYPERLINK("subdir/file.pdf")

Case B:
=HYPERLINK("./subdir/file.pdf")

Case C:
=HYPERLINK("d:/subdir/file.pdf")

Case D:
=HYPERLINK("file:///d:/subdir/file.pdf")


Actual Results:
Case A:
- working hyperlink in ODS
  * path is relative
  * leading to "subdir/file.pdf"
- not working hyperlink in PDF
  * path is relative
  * leading to "file:///D:/./subdir%2Ffile.pdf"
  * a "./" is inserted

Case B:
- working hyperlink in ODS
  * path is relative
  * leading to "./subdir/file.pdf"
- not working hyperlink in PDF
  * path is relative
  * leading to "file:///D:/./.%2Fsubdir%2Ffile.pdf"
  * an additional "./" is inserted

Case C:
- working hyperlink in ODS
  * path is absolute
  * leading to "d:/subdir/file.pdf"
- not working hyperlink in PDF
  * path is relative
  * leading to "file:///D:/./d:%2Fsubdir%2Ffile.pdf"
  * a "D:/./" is inserted
  * I moved subdir and the pdf to "T:\"
  * now leading to "file:///T:/./d:%2Fsubdir%2Ffile.pdf"

Case D:
- working hyperlink in ODS
  * path is absolute
  * leading to "file:///d:/subdir/file.pdf"
- working hyperlink in PDF
  * path is absolute
  * leading to "file:///d:/subdir/file.pdf"


Expected Results:
Case A and B should in any case lead to working relative path.

Case C and D should in any case lead to working absolute path.



Reproducible: Always


User Profile Reset: No



Additional Info:
I used a workaround by computing the actual path.

=HYPERLINK(CONCATENATE(REGEX(CELL("FILENAME");"file:///.+/");"subdir/file.pdf"))

So I get a relative path to the pdf in both the ODS and in the exported PDF file.

One small flaw in my workaround is because there is no celltext given in this example, it does change the linkaddress in the exported PDF, if I copy it to a new location, but not the celltext.

A bigger problem for Mac users may be, that it does not work on a Mac, but I don't have a Mac for daily use to play around with.
Comment 1 Norbert Scheibner 2021-06-07 21:58:39 UTC
Created attachment 172685 [details]
Calc document with the test cases

Calc document with the test cases.
Comment 2 Eleonora Govallo 2021-08-25 20:43:19 UTC
No repro in Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 008f28c9e01114e731f785e9e238236a1ed069d2
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: ru-RU (ru_RU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-08-22_15:17:36
Calc: threaded
Comment 3 Buovjaga 2022-05-19 12:47:53 UTC
Cases A to C are working fine for me with Acrobat Reader and MS Edge. Which reader are you using? Do you still see the problem with the latest version?

Version: 7.4.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: a353f633ec029fc5c7cdc8062aefb6f979265a9e
CPU threads: 2; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: fi-FI (fi_FI); UI: en-US
Calc: threaded Jumbo
Comment 4 QA Administrators 2022-11-16 03:47:01 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2022-12-17 03:19:36 UTC Comment hidden (obsolete)
Comment 6 Norbert Scheibner 2025-05-18 20:36:12 UTC
Just testet it with 25.2.3.2.

Fixed and relative paths in the exported pdf are working now as expected.

I do not know which was the first version, that worked.