Forum Bugs

Link in PDF doesn't work, bug?

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

This is the HTML input, http://cgi.sfu.ca/~jdbates/tmp/css/201006020/

- and this is Prince' output, http://cgi.sfu.ca/~jdbates/tmp/css/201006020/index.pdf

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?
mikeday
The link works when the URL is written like this: http://example.com/#foo. 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.
jablko
Thanks Mike : )

Interesting behavior - here's another example - http://www.sfu.ca/~jdbates/tmp/css/201006030/

- and here's Prince' output - http://www.sfu.ca/~jdbates/tmp/css/201006030/index.pdf

This example has two elements with identical ids (#foo), albeit with different base URLs (http://bbb.com/ and http://ccc.com/)

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 (http://bbb.com/#foo and http://ccc.com/#foo)

This is possibly useful behavior - but unexpected

RFC 3986 section 4.4, http://tools.ietf.org/html/rfc3986#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 http://aaa.com/

I expect only the first link (http://aaa.com/#foo) 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 (http://aaa.com/) - 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 (http://bbb.com/#foo and http://ccc.com/#foo) to not be "same-document" references, because their URI reference isn't identical to the base URI (http://aaa.com/) - I expect them to be external links, so clicking them opens my web browser
mikeday
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.