Wiki source code of Customizations for PDF Export Using URL Parameters
Last modified by Simon Urli on 2026/10/15 11:42
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | You can [[export a Page>>documentation.xs.user.exports.export-page.WebHome]] while viewing a Page, but you can also trigger a PDF export by changing the URL of Pages. For example, replacing "##/view/##" with "##/export/##", and adding the parameter ##format=pdf## will export the current Page: | ||
| 2 | |||
| 3 | {{code language="none"}} | ||
| 4 | http://server/xwiki/bin/export/Space/Page?format=pdf | ||
| 5 | {{/code}} | ||
| 6 | |||
| 7 | {{version since="18.4.7, 18.9.0RC1"}}Opening such a URL shows the [["Confirm the Export" page>>doc:documentation.xs.user.exports.export-page.confirm-export.WebHome]], where you confirm the export.{{/version}} | ||
| 8 | |||
| 9 | In addition, the following URL parameters can be added to customize what should be exported: | ||
| 10 | |||
| 11 | |=Parameter|=Description|=Example|=Image used for example purposes | ||
| 12 | |##format##|You can specify the format in which to export.|{{code language="none"}}http://server/xwiki/bin/export/News/Announcements?format=pdf{{/code}} will export the ##Announcements## Page in PDF.|{{image reference="hierarchy-exports.png" size="small" alt="An example hierarchy of pages relations in a panel"/}} | ||
| 13 | |##pages##|There can be several such parameters, each representing a Page to export. When ##pages## parameters are specified, the current Page specified in the URL isn't used.|{{code language="none"}}http://server/xwiki/bin/export/News/Announcements?format=pdf&pages=News.Announcements.WebHome&pages=News.Updates.WebHome{{/code}} will export the ##Announcements## and ##Updates## Pages. | ||
| 14 | |##includechilds##|Specifies the depth of [[child Pages>>documentation.xs.user.base.page.nested-pages.relations.WebHome]] to include in the [[PDF export>>documentation.xs.user.exports.export-page.pdf-modal.WebHome]]. The value is a number indicating how many levels of child Pages to include.|This URL: {{code language="none"}}http://server/xwiki/bin/export/News?format=pdf&pages=News.WebHome&includechilds=1{{/code}} will export the ##News##, ##Announcements## and ##Updates## Pages, while {{code language="none"}}http://server/xwiki/bin/export/News?format=pdf&pages=News.WebHome&includechilds=2{{/code}} will export the ##News##, ##Announcements,## ##Newsletter## and ##Updates## Pages. | ||
| 15 | |##includelinks##|This parameter controls how many levels of [[linked Pages>>documentation.xs.user.base.page.linking-references.WebHome]] to include in the PDF export. The value is a number that specifies the depth of internal linked Pages to follow.|This URL: | ||
| 16 | {{code language="none"}}http://server/xwiki/bin/export/News/Announcements?format=pdf&pages=News.Announcements.WebHome&includelinks=1 {{/code}}will include in the export the Pages ##Announcements## and ##Updates## (assuming it has an [[internal link>>documentation.xs.user.base.page.linking-references.WebHome||anchor="HInternalLinks"]] to "Updates"), while {{code language="none"}}http://server/xwiki/bin/export/News/Announcements?format=pdf&pages=News.Announcements.WebHome&includelinks=2 {{/code}}will include also the ##Newsletter## Page (assuming it's also linked from the ##News## Page). | ||
| 17 | |##pagebreaks##|If the value is set to ##1##, then a Page break is inserted between all exported Pages. This means that an empty space (or a new Page) is inserted between every Page in the output, ensuring that each Page starts on a new sheet in the final document (such as a PDF).|{{code language="none"}}http://server/xwiki/bin/export/News/Announcements?format=pdf&pagebreaks=1{{/code}} | ||
| 18 | |##comments##|If set to ##1##, then also export the link to the existing comments and to the user profile of the author.|{{code language="none"}}http://server/xwiki/bin/export/News?format=pdf&comments=1{{/code}} | ||
| 19 | |##attachments##|If set to ##1##, then also export the attachments (only if they are images). However, note that images embedded within the document (i.e., displayed directly in the Page content) are already part of the export by default. The attachments parameter specifically exports images that are uploaded to the Page but are not displayed directly within the content. These images are typically found in the [[attachments section>>doc:documentation.xs.user.attachments.WebHome]] of the Page.|{{code language="none"}}http://server/xwiki/bin/export/News?format=pdf&attachments=1{{/code}} |