Bug 879388 - Clickable links to different parts of a book do not work properly in PDF files
Clickable links to different parts of a book do not work properly in PDF files
Product: Publican
Classification: Community
Component: publican (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: 3.1
: ---
Assigned To: Jeff Fearn
: 890641 903742 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2012-11-22 14:28 EST by Jaromir Hradilek
Modified: 2013-02-05 22:40 EST (History)
6 users (show)

See Also:
Fixed In Version: 3.1.0
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-02-05 22:40:43 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jaromir Hradilek 2012-11-22 14:28:48 EST
Description of problem:
When a book is built in the PDF format, clicking cross-references to different parts of the book does not work properly and often skips to a wrong page.

Version-Release number of selected component (if applicable):
publican and wkhtmltopdf in Brew

How reproducible:

Steps to Reproduce:
1. Open the following PDF file in a document viewer of your choice:


2. In the PDF document, open page number 4 with the Table of Contents.

3. Click chapter 2, “Before Configuring the Red Hat High Availability Add-On”.

Actual results:
The PDF viewer skips to the beginning of page 24, that is, to the middle of section 2.5.3., “Disabling ACPI Completely in the grub.conf File”.

Expected results:
The PDF viewer should skip to the beginning of page 17 where chapter 2 starts.

Additional info:
Verified on Fedora 17 with both Evince and Okular.
Comment 1 Ruediger Landmann 2012-11-22 18:36:02 EST
A fresh build of the doc with publican-3.0.0-0.fc17.noarch shows the same problem
Comment 2 Jeff Fearn 2012-11-25 18:09:23 EST
We need to switch from the TOC DocBook generates to a wkhtmltopdf specific TOC.
Comment 3 Jeff Fearn 2013-01-14 02:15:35 EST
I've switched the code to use wkhtmltopdf to generate the TOC, so the TOC now functions correctly, and has page numbers!

However the upstream bug ​http://code.google.com/p/wkhtmltopdf/issues/detail?id=411 means that XREFs will still point to the wrong spot to large blocks.

This fix has been committed to the devel branch for inclusion in Publican 3.1.

I will be looking in to the upstream bug and seeing if I can patch wkhtmltopdf so the links work as expected.
Comment 4 Jeff Fearn 2013-01-23 04:26:56 EST
*** Bug 890641 has been marked as a duplicate of this bug. ***
Comment 5 Jeff Fearn 2013-01-23 19:25:20 EST
OK so I've tracked down why this happens, but couldn't fix the PDF directly so I have a workaround in place.

When linking to an object the landing site for a link is the middle of the rectangle for the object. Since publican puts the IDs in the  DIV surrounding an object this means that the PDF landing site will be the middle of the section, chapter, table, etc. My workaround was to revert the change in ID location so that IDs are now placed on the title element, giving a much smaller rectangle to land on.

This may not fix links to all elements, but it will cover most and any other elements should have their own bugs opened.

This fix has been committed to the devel branch for inclusion in Publican 3.1.
Comment 6 Ruediger Landmann 2013-01-24 23:18:30 EST
*** Bug 903742 has been marked as a duplicate of this bug. ***
Comment 7 xuezhi ma 2013-01-28 03:10:46 EST
Verify version:publican-3.1.0-0.el6eng

Verify steps:
1. Get source file that can be built into the wrong PDF documment in publican 3.0.
2. Rebuilt the document with publican 3.1.
3. In the PDF document, open page with the Table of Contents, click each cross-references.

Actual result:
Every cross-references can be clicked and skip to correct page(it will skip to the beginning of each relative parts of the document).

Note You need to log in before you can comment on or make changes to this bug.