Forum Bugs

Link in PDF doesn't work, bug?

This is an example of a link which doesn't work in a PDF generated with Prince,

This is the HTML input,

- and this is Prince' output,

The target of the link has an xml:base="..." attribute

Clicking the link in the PDF does nothing - I expect it to jump to the second page

Is this a bug?
The link works when the URL is written like this: Is this a bug? Hard to say. It's different to the way browsers behave, and that's annoying enough. We will take a look at this issue and see what we can do.
Thanks Mike : )

Interesting behavior - here's another example -

- and here's Prince' output -

This example has two elements with identical ids (#foo), albeit with different base URLs ( and

I expect to be able to link to only one of these elements because their ids aren't unique - but Prince can link to either of them ( and

This is possibly useful behavior - but unexpected

RFC 3986 section 4.4,

When a URI reference refers to a URI that is, aside from its fragment
component (if any), identical to the base URI (Section 5.1), that
reference is called a "same-document" reference.

This example has three links, all with base URL

I expect only the first link ( to be a "same-document" reference, because it's the only link where the URI reference is, aside from the fragment component, identical to the base URI ( - I expect it to link to the element with id #foo (and do whatever Prince normally does if multiple elements have id #foo)

I expect the second and third links ( and to not be "same-document" references, because their URI reference isn't identical to the base URI ( - I expect them to be external links, so clicking them opens my web browser
Tricky situation. In a way, Prince is treating the elements with different base URIs as if they were parts of a different document, similarly to what would happen if you combined multiple documents on the command line or using XInclude. Generally this is helpful behaviour, as people often do want to combine multiple HTML input documents into one PDF output document. But there are clearly situations where it will lead to unexpected outcomes, and will probably differ from browser behaviour, as they do not have this issue with combining multiple input documents.