Forum Bugs

On landscape pages, anchors/bookmarks link to bottom of page

When a named page with landscape orientation is placed among portrait-oriented pages, bookmarks on the landscape page point to the bottom of the page.

	<style type="text/css">
		@page toc { size: A5 }
		@page p1 { size: A5 landscape }
		@page p2 { size: A5 }
		@page p3 { size: 210mm 148mm }
		@page p4 { size: A5 }

		#toc { page: toc }
		#s1 { page: p1 }
		#s2 { page: p2 }
		#s3 { page: p3 }
		#s4 { page: p4 }

<div id="toc">
	<h1>Table of Contents</h1>
		<li><a href="#s1">Section One</a></li>
		<li><a href="#s2">Section Two</a></li>
		<li><a href="#s3">Section Three</a></li>
		<li><a href="#s4">Section Four</a></li>

<h1 id="s1">One</h1>
<h1 id="s2">Two</h1>
<h1 id="s3">Three</h1>
<h1 id="s4">Four</h1>


When I click on the link to Section One, the PDF reader takes me to the bottom of the Section One page instead. Also, the same thing happens if I click on the PDF bookmark to Section One.

Note that this happens with any page size I try (US-Letter or A4). Also, the actual document isn't nearly so weird as the example code above; I am just trying to reduce the problem to its basic elements.

I did find a workaround: specify the page measurements rather than using "landscape." For example, use "210mm 148mm" instead of "A5 landscape", or "11.0in 8.5in" rather than "US-Letter landscape". You can see this in my example above.

My environment:
    Prince 7.0
    Mac OS 10.5.8
    Preview 4.2
    Adobe Reader 8.1.2

I also tested the PDF output in Adobe Reader 9.3.0 on Windows 7. The symptoms were identical.
This is an issue with landscape pages that I don't think we can easily fix, because a landscape page is essentially a rotated portrait page, making it difficult to specify a link to a particular vertical position on that page. Specifying an explicit size for the page is a good workaround for now. :)
Thanks for the prompt reply. I'm curious now why, to implement landscape, you couldn't just translate the "[sizename] landscape" value to a "[width] [height]" value and then run it through the same code used for portrait pages, not doing any funky rotating stuff. Like they say, though, if it were that easy, someone would have done it by now.
That's exactly what we used to do, but it complicates printing in some cases. It comes down to whether the landscape page is supposed to be unrotated and just happens to be wider than it is tall, or whether it is a special case of a portrait page rotated by 90 degrees. Different users have different needs for landscape pages, so we might need to introduce a new mechanism to give more control over these two cases.
I just ran into the same problem. I have a mix of portrait/landscape pages that I want to use PDF bookmarks with. In the prince TOC on the first page, bookmarks that link to landscape pages show the correct page number, however they jump to the page after when clicked. (e.g. link to a landscape page indicates Pg 3, when clicked it incorrectly jumps to Pg 4).

Are there any workarounds to resolve this problem?
I'm having trouble reproducing this, would you be able to email me ( a small document that demonstrates the problem?
Thanks for looking at this. I just emailed your an example html to illustrate the problem I am seeing. If you click on any of the LANDSCAPE page links, you will see they jump to the page after.

Tested on:
OS: Mac OSX 10.7.4
Prince: 8.0 and 8.1
Command: $ prince test.html -o test.pdf
Thank you for the sample document. Looking at the PDF, the links are actually pointing at the correct pages. However, they also include a vertical offset within each page, to scroll the viewer to the exact heading that the link is pointing at. Unfortunately, Adobe Reader seems to interpret this offset badly for landscape pages, and it scrolls down so far that it ends up entirely on the next page. Other PDF viewers do not seem to have this problem, and show the correct page.

We can try and work around this issue by changing the way we specify page offsets for landscape pages.
I've tried other workarounds, like referencing an h1 tag in the div instead of the div itself, but still seem to have a problem. Is there a way to create custom bookmarks that links to a specific page number instead of an anchor on a page? Or perhaps some other workaround that might allow me to create a custom TOC with hyperlinks that go the page I want.

Thanks for looking at this.
We've found a fix for this issue that also allows us to link to particular content within a landscape page, which Prince could not do before. We will release it soon along with a couple of other bug fixes as Prince 8.1 rev 3.
Fantastic! Thank you for taking the time to find a solution, I look forward to the release.
Prince 8.1 rev 3 is now available for download, and should improve the handling of links to content on landscape pages.