Bug 171885 - PDF Export missing internal links to captions
Summary: PDF Export missing internal links to captions
Status: RESOLVED DUPLICATE of bug 167993
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
26.2.2.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Fields-Cross-Reference
  Show dependency treegraph
 
Reported: 2026-04-27 15:25 UTC by rygle
Modified: 2026-04-29 08:00 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Test Hybrid PDF/ODT with three "Drawing" cross-references and various combinations of links to original reference (42.25 KB, application/pdf)
2026-04-27 15:25 UTC, rygle
Details
Original Test ODT with three "Drawing" cross-references and various combinations of links to original reference (14.76 KB, application/vnd.oasis.opendocument.text)
2026-04-27 15:27 UTC, rygle
Details
Test doc 2.odt (28.90 KB, application/vnd.oasis.opendocument.text)
2026-04-28 03:13 UTC, rygle
Details
Exported PDF from Test Doc 2 - PDF 2.0 format (86.36 KB, application/pdf)
2026-04-28 03:20 UTC, rygle
Details
Test Document 2 PDF 1.7 Export few PDF options ticked (35.29 KB, application/pdf)
2026-04-28 03:23 UTC, rygle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rygle 2026-04-27 15:25:54 UTC
Created attachment 206837 [details]
Test Hybrid PDF/ODT with three "Drawing" cross-references and various combinations of links to original reference

What happens?

* Created a document with multiple images.
* Each image had a caption
* I referred back to each caption at other places using Insert -> Field -> More Fields -> Cross-References -> Type = Drawing/Figure, etc -> Selection = Various -> Refer using = Number.
* This method was used to dynamically renumber every cross-reference in case captions were added or removed. It was also done to give each cross-reference a clickable link within the document.
* In the original ODT document this works perfectly. Cross-reference numbers are dynamic. All cross-references inserted this way are links.
* When exported to PDF, only the last cross-reference on any given line functions as a clickable link.

What behaviour is expected?
* All cross-references should be dynamic (this seems OK)
* All cross-references should be clickable links in PDF exported documents as in ODT.

Examples:
* See attached ODT and PDF (Hybrid).
* The PDF only allows clicking on the last link per line.
* All cross-references inserted using the same method.
* The same occurs whether the caption is inserted as "Drawing", "Figure" etc.
Comment 1 rygle 2026-04-27 15:27:36 UTC
Created attachment 206838 [details]
Original Test ODT with three "Drawing" cross-references and various combinations of links to original reference

This is the original ODT file that the PDF was generated/exported from.

This is only a test case. The bug occurred in a different document and I was able to reproduce it with this simple example.
Comment 2 rygle 2026-04-27 15:41:27 UTC
This is similar to https://bugs.documentfoundation.org/show_bug.cgi?id=160381 but not the same.

This is about links only succeeding in PDF if they are the last link/cross-reference on a line.

#160381 is about links failing when single characters in length but succeeding when  multiple characters in length.
Comment 3 raal 2026-04-27 16:29:09 UTC
Confirm with Version: 26.8.0.0.alpha0+ (X86_64)
Build ID: fe65c51b4000b21d426b6ba7b8238bdab3ed144c
CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

but works in 7.3.7
Comment 4 raal 2026-04-27 16:44:51 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-24.2$.

 c61d2c226f38d041d2d97793ddccb5e95c6d7964 is the first bad commit
commit c61d2c226f38d041d2d97793ddccb5e95c6d7964
Author: Jenkins Build User <tdf@maggie.tdf>
Date:   Thu Nov 2 10:49:49 2023 +0100

    source 6593d680e21c24501a58bac216de4a7c71541959

158571: tdf#157816 sw: PDF export: filter out links on empty space, fields | https://gerrit.libreoffice.org/c/core/+/158571
Comment 5 rygle 2026-04-28 03:12:05 UTC
I may be wrong about this bug being connected to tdf#160381

I have created a revised test document "Test Doc 2.odt" starting from the previous "Test Doc.odt" but with extra shapes with captions of type "Drawing" and "Figure", both numbering into the double digits.

It seems that my described case persists, that a link will only be present for the last link on a given line.

However, the double digit/character bug of tdf#160381 is also present. In other words, a link will only be generated in an exported PDF if it is either a double digit number, or last on a line.

See in the test document the last line has text "Figures 10, 7, 12, 3" and both double digit references create a link, as well as the single digit link that is last on the line.

It also does not seem to make a difference what "PDF Options" I select in the export dialogue.
* No difference whether PDF 1.7 and PDF 2.0
* No difference whether "Hybrid PDF (embed ODF file) selected (except for size)
* No difference whether any of the "Structure" options are selected or not
* No difference whether Links -> General options are selected or not
* No difference whether Links -> Cross-document Links is set to Default or otherwise.
Comment 6 rygle 2026-04-28 03:13:44 UTC
Created attachment 206840 [details]
Test doc 2.odt

New test document with captioned "Drawings" and "Figures" into double digits.
Comment 7 rygle 2026-04-28 03:20:24 UTC
Created attachment 206841 [details]
Exported PDF from Test Doc 2 - PDF 2.0 format

PDF exported from test document 2 with captioned "Drawings" and "Figures" numbering into double digits.

Exported as PDF 2.0 with options ticked in PDF Options export dialogue:
* General -> General -> "Hybrid PDF (embed ODF file" ticked
* General -> Structure -> "Tagged PDF (add document structure)" ticked
* Links -> General -> "Convert document references to PDF targets" ticked
Comment 8 rygle 2026-04-28 03:23:02 UTC
Created attachment 206842 [details]
Test Document 2 PDF 1.7 Export few PDF options ticked

PDF exported from test document 2 with captioned "Drawings" and "Figures" numbering into double digits.

Exported as PDF 1.7 with very few options ticked in PDF Options export dialogue:
* General -> General -> "Hybrid PDF (embed ODF file)" *not* ticked
* General -> Structure -> "Tagged PDF (add document structure)" *not* ticked
* Links -> General -> "Convert document references to PDF targets" *not* ticked
Comment 9 raal 2026-04-29 08:00:54 UTC

*** This bug has been marked as a duplicate of bug 167993 ***