Multipage PDF Export: Article context specific footer

Hello everybody,

I have a question regarding PDF templates for the PDF Export Application.

For example, I want to export wiki article “X” and its child articles “Y” and “Z”. The export’s cover page shows page title, date and revision for “X”, which is okay. I modified the footer as follows:

grafik

This is the code I use in the PDF Export Template footer:

{{velocity}}
{{html clean="false"}}

Pfad: <a href="$doc.getExternalURL("view")">$util.decodeURI($doc.getURL())</a>, v<a href="$doc.getExternalURL("","viewer=history&showminor=true&rev=" + $tdoc.version)">$tdoc.version</a>, zuletzt geändert $xwiki.formatDate($tdoc.date, "dd.MM.YYYY H:mm")

<div style="float: right">Seite: <span class="pdf-page-number"></span> / <span class="pdf-page-count"></span> </a></div>
{{/html}}
{{/velocity}}

Unfortunately, now the footer of every PDF page contains that same path and revision of article “X”, even for PDF pages that contain child article “Y” content.

How can I change the PDF footer template to be „context“ aware, i.e. show link, revision, etc. of the contained page, not the parent page from which I started the export?

Thanks for any hints!

You can’t achieve this only from the footer. You need to have the information (hidden) somewhere in the exported content. The idea is to use the footer template property to configure the footer layout and to inject, using CSS, the footer content from the exported content.

Check how the header is behaving when multiple pages are exported:

Hope this helps,
Marius

1 Like

Ah, thanks. I was afraid that this might be more tricky to achieve. Will try to dig deeper into this topic as soon as time allows. Thanks for the hints, so far!

edit: Sorry for not marking this as solved yet – I’ll try to contribute my solution here when I find it :wink:

1 Like