Bug 879388

Summary: Clickable links to different parts of a book do not work properly in PDF files
Product: [Community] Publican Reporter: Jaromir Hradilek <jhradile>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: futureCC: ldimaggi, rglasz, r.landmann, rlandman, rmaurya, xma
Target Milestone: 3.1   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.1.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-02-05 22:40:43 EST Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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:
Always.

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

   https://access.redhat.com/knowledge/docs/en-US/Red_Hat_Enterprise_Linux/6/pdf/6.3_Technical_Notes/Red_Hat_Enterprise_Linux-6-6.3_Technical_Notes-en-US.pdf

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).