Forum Feature requests

PDF Functions

It would be neat if there was a way for Prince to include common PDF creation options such as bookmarks, and table of contents, similar to XSL:FO's "fo:basic-link internal-destination" tag, and "fo:page-number-citation" tag.
(Clarification: the page-number-citation in FO allows the user to dynamically generate a table of contents by including an id attribute in this function which matches up with the id of the tag that you wish to point to. This way, the table of contents will update itself, regardless of whatever page the desired link happens to fall on.)
Maybe this is outside of the scope of Prince (since it wouldn't be traditional css), but it is *really* helpful in creating the PDF to the point where no editing changes have to be made to a dynamic document.
Maybe there is a way to do this I haven't discovered yet?
I am happy to be able to say that Prince 5.0 includes support for PDF links, bookmarks and metadata. You will get them automatically if you are using XHTML: <a href="...">...</a> will be turned into an internal or external PDF link, the heading elements h1, h2, h3 ... will generate appropriately nested PDF bookmarks, and the meta and title elements will be included as PDF metadata.

If you are using your own XML markup then you will need to assign linking and bookmark behaviour yourself using the new CSS properties. (You might like to take a look at the default style sheet for XHTML to see how it is done; note that the "prince-" prefix on the properties is actually optional).

prince-link: none | attr(...) | url(...)
prince-bookmark-level: none | <number>
prince-bookmark-label: none | <content>

Prince 5.0 has a number of other new features, such as support for GIF images, CSS positioning and several other CSS properties mentioned in the release notes.
I forgot to mention that Prince 5.0 also supports cross-references, which you can use in a table of contents to give the page numbers of chapters or sections.

Cross-references are added using generated content with the target-counter and target-content functions. Here is an example:

a[href]::after {
    content: " (See page " target-counter(attr(href), page) ")"

This will add the value of the page counter of the linked element after the link itself, so that this input:

This example is in <a href="#chapter3">Chapter 3</a>.

is turned into this output:

This example is in Chapter 3 (See page 42).

The target-content function is similar, but it retrieves the content of the linked element, which is handy for including the chapter title in the cross-reference.

You might like to take a look at the webarch.html example document that comes with the Prince 5.0 beta; it includes a table of contents with cross-references and leaders, as well as page headers/footers generated using content taken from the document with the string-set property.
The new 'target-counter' property seems to be very useful.
In mathematical articles there are many cross references pointing to equations. Numbering of equations can be done using CSS counters,
but when one adds new or removes old equation, he/she has to update cross references too. With target-counter property there is no need to modify cross references as counter values can be retreived via CSS.
Here is example that shows how 'target-counter' function can simplify life:
<div class="formula" id="PoissonBracket">
{J(x) , J(y)} = 0
<a href="#PoissonBracket"/>
Style Sheet:
.formula {counter-increment:equation;}
.formula::before {content:"(" counter(equation) ")";display:block;float:right;}
a[href^="#"] {content: "(" target-counter(attr(href), equation) ")";text-decoration:none;}