Bug 160912

Summary: Export an *.odt document towards a *.pdf file (source), containing at least one relative hyperlink \ URL pointing to another *.pdf file (target)
Product: LibreOffice Reporter: devEric69 <eric.moutie>
Component: Printing and PDF exportAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: stephane.guillou
Priority: medium    
Version: 6.0.7.3 release   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
URL: https://forum.openoffice.org/fr/forum/viewtopic.php?t=68683
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: The dialog boxes for my test case
simple test kit

Description devEric69 2024-05-02 14:57:45 UTC
Description:
Hello,

To Summarize: can LibreOffice export an *.odt document (origin ) towards a generated pdf file (source displayed in an internet navigator page), file in which we could have relative hyperlinks \ relative URLs, leading towards other targeted pdfs files (to be displayed in a _top, _blank, ..., internet navigator page), all *.pdf (source and its targets) being in obviously placed in the same partition (in my case: "C:\documents\*")?

Regards.

Steps to Reproduce:


(bug tested with LibreOffice version 6.0.7.3. and version 7.6.6.3., French language resource selected) I've a problem with the menu "Fichier \ Exporter vers... \ Exporter au format pdf" function:
1. settings: my LibreOffice Writer software is supposed to know how to work, as far as it can, with relative access paths on the hard disk and internet URLs, thanks to the "Outils \ Options... \ Chargement/enregistrement \ Générale" settings, like this: checkboxes "Enregistrer en relatif les URL sur le système de fichier" checked and "Enregistrer en relatif les URL sur Internet" checked.
2. I want to create a pdf document, generated from an *.odt file using LibreOffice Writer and its pdf export; The said *.odt source file is called `GenesePdf.odt`. In this file, I've created a simple Internet hyperlink (protocol = Web), pointing to `./le_fichier_a_lier.pdf` (← I've tested with `le_fichier_a_lier.pdf` relative URL too, in the edit-box called "URL" in the modal dialog box called "Hyperlien"), which has the following characteristics.
3.Then, I export this `GenesePdf.odt` document (via "Fichier \ Exporter vers... \ Exporter au format pdf") with this context: in the "Lien" tab of this same "Options PDF" dialog box, only the "Exporter les URL relatif au système de fichier" checkbox is checked, and the "Mode par défaut" radio button is selected for the "Liens entre documents" group box.


Actual Results:
➔ the pdf file created doesn't contain any valid hyperlink (i.e. no functional hyperlink created towards the file named `le_fichier_a_lier.pdf`: just a blue and underlined inert text). Hence my bug report.

Expected Results:
A generated *.pdf file (source) having functional hyperlink leading towards other relative URLed *.pdf files (targets). Relative relative URLed, so that we can move these files from one device to another : NAS towards Internet, towards USB key, etc..., and the source pdf file will continue to display its targeted pdf files.


Reproducible: Always


User Profile Reset: No

Additional Info:
Example of the description of such afunctionality I'm trying to get to work, without success: https://www.oooninja.com/2008/02/create-relative-links-in-pdfs.html .
Comment 1 devEric69 2024-05-02 15:06:36 UTC
I've also tested this feature with OpenOffice 4.1.15: it didn't work either (no valid hyperlink in the generated pdf export).
Comment 2 devEric69 2024-05-02 15:11:30 UTC
Created attachment 193941 [details]
The dialog boxes for my test case
Comment 3 devEric69 2024-05-03 07:58:12 UTC
A discussion thread (in french), about this anomaly: https://forum.openoffice.org/fr/forum/viewtopic.php?t=68683 .
Comment 4 Stéphane Guillou (stragu) 2024-05-22 00:54:41 UTC
Thanks for the report.

I tested these steps:

1. Open Writer
2. Tools > Options > Load/Save > General > both "Save URLs" options are checked (which are the default values)
3. Link some text using Insert > Hyperlink > Internet > Document > Path: ./target.pdf
Result 1: the link does not work when used inside Writer.
Message is: "./target.pdf" cannot be passed to an external application to open it (e.g., it might not be an absolute URL, or might denote no existing file).
Similar issues:
- https://superuser.com/questions/1675026/libreoffice-relative-link-to-another-docx-on-local-system-not-working
- https://ask.libreoffice.org/t/hyperlink-failure-local-link-cannot-be-passed-to-an-external-application-to-open-it/67822
- bug 118594
The issue is that entering the path by hand won't work, but using the file picker button next to the field will work. It _will_ display an absolute path in the dialog, which looks wrong according to the settings we have in Options, but the path is actually saved in relative form in the file. You can confirm that by then exporting the PDF:
4. Export PDF to the same directory as the target
5. Open PDF and test the link: works
6. Move file together to a different directory, test again: works

Essentially, the root issue is that the dialog displays an absolute path when we chose to store relative paths, leading to users trying alternative methods like entering the path by hand. So I am marking as duplicate of bug 128216.
I hope that makes sense, and that using my steps above (using "Document" instead of "Internet" in the Hyperlink dialog), you can make it work!

Tested with:

Version: 24.2.3.2 (X86_64) / LibreOffice Community
Build ID: 433d9c2ded56988e8a90e6b2e771ee4e6a5ab2ba
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

*** This bug has been marked as a duplicate of bug 128216 ***
Comment 5 Stéphane Guillou (stragu) 2024-05-23 00:14:23 UTC
Created attachment 194284 [details]
simple test kit

ODT can be exported to PDF, and then files moved together, to test relative linking.