How to export multiple pages to PDF?

Last modified by Vincent Massol on 2020/06/04

This is not yet a standard feature of the product, but there is a trick that can be used that is, in a good amount of cases, fulfilling the need. 

XWiki provides the display macro. This macro allows to display the content of a page in another page. A particular use case is when a user would construct a document that has no own content, but only displays other documents. Then, this constructed document will behave like any other document in the wiki, and this includes being able to export as PDF (or other formats). The display macro is fully dynamical, meaning that when a displayed document is updated, the constructed document will also display on screen the updated content, so you don’t need to worry about updating the "constructed" document manually any time you make changes to a document that composes it.

This "trick" can be used to assemble larger PDF files from multiple wiki documents.

With just a little bit of velocity scripting (if you have some development skills or a developer that can help), it’s possible to automate this and have such a constructed document include all its children so that you don’t need to worry anymore about updating the constructed document when a new child page is added.

Note that if you construct the result yourself with the display macro you can fully control the order in which the documents are included in the resulted PDF instead of having an "automatic" order, in case you need to control that.

Tags:
   

Get Connected