Writer: Master document with partial documents - export functions do not adapt hyperlinks to fragments in partial documents The following export functions are affected: - Master document for .odt file - Master document to .pdf file LibreOffice Community version: 7.1.6.2 Operating system: Ubuntu 20.04.1 I have created a master document with several sub-documents. In the part-documents there are hyperlinks to fragments of another part-documents. These hyperlinks are not adapted when exporting to an .odt file or a .pdf file. A hyperlink xlink: href = "../ Teildokument2.odt#Heading" remains that way, but should be in xlink: href = "#Heading" can be changed (xlink: type = "simple"). Hyperlinks that point to destinations outside of the global and partial documents of the global document must be retained. Translated with Google Translate from German
Harald, thank you for reporting the bug. Please attach a sample document (masterdocument with some subdocuments), as this makes it easier for us to verify the bug. I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided. (Please note that the attachment will be public, remove any sensitive information before attaching it) I'm not sure, if I understand everything in your report (for example what do you mean with "Fragment"). Sometimes deepl.com is a better choice for translation. It's also no problem - as far as I know - to write a report in German and add the translated version in English.
Hello Dieter, first to your question about the "fragment". Here I refer you to the RFC 3986 for the structure of a URI, heading "3. Syntax Components". Since I was not able to upload the documents as attachment I sent them to your mail address. There you will find a zip file containing a simple global document with its sub-documents, where in the sub-document "About this Guide" with the chapter "About this Guide" simply hyperlinks to the sub-documents "Introduction" and "Login to the Switch". The content.xml of the global document contains the following references: xlink:type="simple" xlink:href="../About_this_Guide.odt#1.About%20This%20Guide%7Coutline" xlink:type="simple" xlink:href="../Introduction.odt#1.Introduction%7Coutline" xlink:type="simple" xlink:href="../Login_to_the_Switch.odt#1.Login%20to%20the%20Switch%7Coutline" When I export this from the global document to a PDF file the following links are in the PDF file: file:///home/haraldbraun/Dokumente/fehlersuche/-About_this_Guide.odt#1.About%20This%20Guide%7Coutline file:///home/haraldbraun/Dokumente/fehlersuche/-Introduction.odt#1.Introduction%7Coutline file:///home/haraldbraun/Dokumente/fehlersuche/-Login_to_the_Switch.odt#1.Login%20to%20the%20Switch%7Coutline For me file:///home/haraldbraun/Dokumente/fehlersuche/ is the directory in which a) the global document b) the partial documents and c) the exported PDF file. Clicking on the hyperlink in the PDF file does not lead to the target. If I now create an .odt file from the global document using the export function, then unpack the .odt file and change the "content.xml" of this .odt file so that the references look like this: xlink:type="simple" xlink:href="#About%20This%20Guide%7Coutline" xlink:type="simple" xlink:href="#Introduction%7Coutline" xlink:type="simple" xlink:href="#Login%20to%20the%20Switch%7Coutline" save the "content.xml" and then create an .odt file again from the archive files (zipping) I have created the prerequisites for a working PDF file. From this .odt file I then export the PDF file again. And lo and behold, the hyperlinks work just fine. Many greetings Harald Translated with www.DeepL.com/Translator (free version)
Hello Dieter, sorry the new references looks like this: xlink:type="simple" xlink:href="#1.About%20This%20Guide%7Coutline" xlink:type="simple" xlink:href="#1.Introduction%7Coutline" xlink:type="simple" xlink:href="#1.Login%20to%20the%20Switch%7Coutline"
Harald, thank you for the documents. It took some time until I could have a look at it. I could find out the following: 1. If you add a link to a document, link in exported PDF works as expected. 2. If you add a link to a target within a document (for example a heading) link in exported PDF doesn't work. This is true for every document and not related to master documents. At least it is th underlying problem that should be reslved first. So I changed bug summary and hope you agree. Could you please test, if you can confirm the followong steps? Thank you. Steps to reproduce 1. Open an new document and write some words 2. Insert hyperlink with heading in a different document as target (Insert -> Hyperlink -> select document -> select target) -> O.K. 3. Export as PDF Actual result Link doesn't work. Tested with Version: 7.3.0.0.alpha1+ (x64) / LibreOffice Community Build ID: 742b8befecbcfc0cfab87cfcd87c83b7d8ef32ab CPU threads: 4; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win Locale: de-DE (de_DE); UI: en-GB Calc: CL Additional informations Link to target within the same document works as expected. Link to external document (without a special target) works as expected BTW: If you want to set a link to a heading within the same document, it's much better to work with cross references (Insert -> Fields -> More Fields -> Tab "Cross References" -> Type Heading)
Hello Dieter, thank you very much for your comment 4. Try 1: ========== I have completed and tested your steps for reproduction a little bit: 1. Open a new document and write some words (including the word "document2"). 2. Saving this 1st document under any name. 3. Open another new document and create the heading "Document2". Formatted with heading1. 4. Save this 2nd document under any name. 5. Open the 1st document; mark the word "Document2"; Insert -> Hyperlink -> Select document (2nd document) -> Select target (heading "Document2") -> O.K. 6. Export as PDF (in doing so, under the "PDF Options" on the "Links" tab, the option "Convert document links to PDF targets" was NOT checked. 7. save the PDF file. 8. open PDF file and click on link. Result: The link does not work! NO error message If you move the mouse cursor over the hyperlink in the generated PDF file you can see the following: "file://<path>/Document1.odf#Document2%7Coutline" (<path> is the placeholder for my local directory path). Try 2: ========== Now I repeated step 5. and in step 6. under "PDF Options" on the "Links" tab I checked the option "Convert document links to PDF targets". Repeated steps 7. and 8. Result: The link does not work! The error message appears: "External link could not be opened/ Error fetching information for file >><path>/Document2.pdf<<: file or directory not found" (<path> is the placeholder for my local directory path). The link does not work, that the 2nd document was not converted to a pdf file. In the "content.xml" of the 1st document the following is stored to the hyperlink: <text:a xlink:type="simple" xlink:href="../Document2.odt#1.Document2%7Coutline" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">Document2</text:a> Notes on the global document with its sub-documents: ========================================================= Basically, MANY documents with their links are united into ONE document here when exporting to a PDF file or to an .odt file. Hyperlinks can be here: Case 1: (a) from the global document to one or more sub-documents, (b) from a sub-document to one or more sub-documents refer. Case 2: In addition, there may be hyperlinks here that point to external files that are not part of the global document and its sub-documents. In case 1, the hyperlinks must work within the target document when exported and thus be converted to hyperlinks to internal targets of a file. In case 2, the hyperlinks must be designed to open the original files separately from the PDF or .odt file (if the link is available). I hope I could help you with this. Translated with www.DeepL.com/Translator (free version)
Harald thanks for that retest. So I change status to NEW.
It's much easier to test if there are minimal sample documents created and attached here.
Is this the same as bug 142707?
(In reply to Timur from comment #8) > Is this the same as bug 142707? Hello Timur, I think bug 142707 this is a additional problem. Here is my current workaround to solve my problem: It is possible to export a PDF file from a global document (.odm file). However, the hyperlinks that link certain topics with partial documents of the global document are not adapted. In the PDF file then a) the targets are not found, or b) if the document parts are accessible, they are accessed. If such a PDF file is sent or transferred to another computer, case a) is always active. This is not desirable. For this reason, the basic procedure is as follows. 1: 1. update all directories and links in the global document (.odm file). Attention: This currently takes between 2.5 and 4 hours. 2. 2. save the global document 3. create a normal Writer document from the global document (.odt file; File -> Export) 4. deactivate links and write protection in .odt file; remove links 5. save .odt file 6. change relevant hyperlinks in .odt file Save .odt file. 7. Export a PDF file from an .odt file. Create .odt file from .odm file. ======================================== 1. open .odm file Answer Yes to the question whether all links should be updated. 3. 3. when the links are updated: save the .odm file 4. then File -> Export and create .odt file 5. close .odm file 6. open .odt file 7. answer with No to the question whether all links should be updated. 8. go to Format -> Areas... Go to Format -> Areas... 9. range: mark all ranges (mark 1st range; go down and mark last range with Shift+Click. 10. shortcut: deactivate shortcuts 11. write protection: deactivate protection 12. click the OK button 13. save .odt file 14. go to Format -> Areas... Go to Format -> Areas... 15. 15. range: Mark all ranges (mark 1st range; go down and mark last range with Shift+Click. Click on the "Remove" button. 17. Close the window with the OK button. 18. Save the .odt file. Adapt hyperlinks in .odt file ================================= Copy the .odt file into an empty temporary directory. 2. 2. change to the temporary directory 3. open .odt file with archive management (.odt file is a zip archive) 4. unpack the .odt file into the temporary directory. Finally, click on "Show file". 5. Close the archive management. 6. 6. search for the file "content.xml" in the temporary directory and open it with Atom. 7. 7. call Find -> Find in Buffer 8. in Find: (href=")+.{5,90}(\.odt#). Assumption: File whose hyperlinks are to be adapted has the file name "Gradle_User_Manual.odt". 9. 9. enter: href="# in Replace. Mark the option "Regular Expression" (.*) and wait until the searched places are marked by Atom. 11. Search for the first entry with the "Find" button and, if OK, change the marked entry with the "Replace" button. 12. Click the "Replace" button until all relevant hyperlinks have been changed. 13. 13. Save content.xml in the archive. 14. Close content.xml and Atom. 15. 15. Mark the .odt file. Call up the "Rename..." function. Execute the key combination Ctrl+A. Execute the key combination Ctrl+C. Press the ESC key. 16. Mark all files except the .odt file. 17. Call up the "Compress..." function. In the "Archive name" field, execute the key combination Ctrl+V. Then click on "Create". (Files are compressed into a zip archive; file extension .zip). 18. Delete the "old" .odt file in the temporary directory. 19. Mark the Zip archive. Call up the "Rename..." function. Remove the .zip file extension. Complete "Rename...". 20. Mark and delete all files in the temporary directory with the exception of the newly created .odt file. Export PDF file ===================== 1. open .odt file with the changed hyperlinks 2. go to File -> Export as -> Export as PDF... go to 3. window PDF options Tab: General Area: Select option "All Area: Mark "Show PDF document after export". Images: Mark option "JPEG compression quality" and enter value "90%". Images: Mark "Reduce image resolution" and enter value "300DPI". General: Mark "(PDF/A, ISO19005)-Archive". General: Select "PDF/A version: PDF/A-2b". Structure: Select "Export outline". Structure: Select "Export automatically inserted blank pages". Tab: Initial display Areas: Mark option "Outline and page Enlargement: Mark option "Standard Page layout: Mark option "Standard Tab: User interface Window options: Mark "Show document title". Transitions: Mark "Use transition effects". User interface options: Mark no option Collapse outline: Mark option "Show all". Tab: Shortcuts General: Mark "Export outline as named destinations". Links between documents: Mark option "Standard behaviour". Tab: Security Nothing can be marked?? Tab: Digital signatures Nothing can be marked???? Click on the "Export" button. 5. Specify a file name for the PDF file (e.g. 20210913_Gradle_User_Manual_7.2_002.00.pdf). 6. Click on the "Save" button. Translated with www.DeepL.com/Translator (free version) Translated with www.DeepL.com/Translator (free version)
Leaving aside the topic of master documents, I followed the steps in comment 5, and the link would not work in Evince, but it would in Okular. So from what I can see, it depends on the PDF reader you use. Harald and Dieter, can you please test with alternate PDF readers to see if that's the case for you as well?
Hello Stèphane, Case 1: We have a PDF document with a link to a LibreOffice-odt document. When creating the PDF file, the option "Convert document links to PDF targets" was not checked. Evince: link does not work. Foxit reader: link works. muPDF: Link works. Master PDF Editor: Not tested, because Russian product. Case 2: We have a PDF document with a link to a LibreOffice-odt document. When creating the PDF file the option "Convert document links to PDF targets" was checked. Evince: Link does not work. Foxit Reader: Link does not work. muPDF: Link works. Master PDF Editor: Not tested, because Russian product. I hope this helps you... Note: But this is not my problem. See bug description. Harald
(In reply to harald.braun.p from comment #11) > Evince: link does not work. > Foxit reader: link works. [...] > Foxit Reader: Link does not work. > muPDF: Link works. OK, so at least we can confirm that PDF links not working (as in comment 4) is not our issue but rather missing support in some PDF readers. (In reply to harald.braun.p from comment #11) > Note: But this is not my problem. See bug description. Let's have a look at this ODM to ODT issue then. I know you shared them with Dieter, but can you please attach your sample documents here so others can test? https://bugs.documentfoundation.org/attachment.cgi?bugid=144488&action=enter
Changed summary to focus again on master export, but please provide minimal example files to illustrate. Please also see existing reports on the topic, your issue might already be covered there: https://bugs.documentfoundation.org/buglist.cgi?query_format=advanced&resolution=---&short_desc=master link&short_desc_type=allwordssubstr
Hello Stèphane, Unfortunately, for health reasons, I won't have time to create any more sample files in the near future. In addition, I have already sent the documents available to me several times by e-mail. So there should be enough material available. I'm sorry that I can't help at the moment. Best regards /Harald
Thank you Harald, I understand. Please feel free to unsubscribe to the report. --- I tested with my own files created from scratch: - sub-document ODT 1 with two headings - sub-document ODT 2 with two headings + a hyperlink to one of the headings in sub-document 1 What I see: * In subdoc 2, the target comes up as "1.Heading 1 of subdoc 1|outline" in the hyperlink dialog. * Clicking the hyperlink in the Master document opens subdoc 1 in a new window. * PDF export: * link is "subdoc1.odt#1.Heading%201%20of%20subdoc%201%7Coutline" * link does not work in Evince / Firefox / Chromium, but it _does_ in Okular, leading to opening subdoc 1 at the correct heading * using the option "convert to PDF targets" does not help as it converts the link to "subdoc1.pdf#1.Heading%201%20of%20subdoc%201%7Coutline" (subdoc1.pdf does not exist) * ODT export: * link does work, opens subdoc 1 at the correct heading * It is possible to insert into the master document a hyperlink to a heading of a subdocument, but that has to be done in a text section of the master, after having included the subdocuments. My conclusion: I agree with Harald that hyperlinks to parts of documents should be converted on export to PDF so they can be used to move inside the PDF (instead of opening the source subdocument). Or at least have an option of the kind "Simplify document target links for included files" that would follow the logic "if the link URI points to a file that is included as a subdocument, simplify it so it is internal to the exported file". Version: 7.6.5.2 (X86_64) / LibreOffice Community Build ID: 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b 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 See also bug 145676.
Created attachment 193219 [details] test kit: two ODT subdocs, one ODM master Test files as described in previous comment. Created with: Version: 7.6.5.2 (X86_64) / LibreOffice Community Build ID: 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b CPU threads: 8; OS: Linux 6.5; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded But exports with recent trunk build has same results: Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 53c5d570cab036b23f4969b858a648c8f0c24f93 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 See also bug 52444, about having the option to export a "self-contained and self-sufficient" ODT, which this enhancement could be a part of.
See also related user questions: - https://ask.libreoffice.org/t/cross-references-between-sub-documents/4574 - https://forum.openoffice.org/en/forum/viewtopic.php?t=13724