Wiki source code of Exports

Last modified by Vincent Massol on 2025/01/03

Hide last authors
Raluca Moisa 29.2 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
Vincent Massol 1.1 4
Vincent Massol 116.2 5 = Usage =
6
Marius Dumitru Florea 108.1 7 As a user, you can export a single wiki page or a set of wiki pages into several formats. To perform a page export click on "Export" in the "More actions" menu.
Silvia Macovei 16.1 8
Marius Dumitru Florea 108.1 9 {{image reference="ExportFlamingo.png" /}}
Sorin Burjan 25.1 10
Marius Dumitru Florea 108.1 11 This opens the Export Modal from where you can select the export format.
Silvia Macovei 16.1 12
Marius Dumitru Florea 108.1 13 {{image reference="exportDialog.png" /}}
Silvia Macovei 46.1 14
Marius Dumitru Florea 114.2 15 The next step depends on whether the selected format supports multi-page export or not and whether the current page is [[a nested page or a terminal page>>xwiki:Documentation.UserGuide.Features.ContentOrganization.WebHome]]:
Marius Dumitru Florea 108.1 16
Marius Dumitru Florea 114.2 17 * if multi-page export is supported, like in the case of XAR export, and the current page is a nested page then the Export Tree Modal is shown(((
Marius Dumitru Florea 108.1 18 {{image reference="exportTreeModal.png" /}}
19 )))
20 * otherwise the user is taken directly to the dedicated page for the selected export format
21
Thomas Mortagne 117.1 22 In addition, Admins can also export all the pages of the wiki through the [[Import/Export Admin feature>>Documentation.AdminGuide.ImportExport]].
Vincent Massol 65.2 23
Vincent Massol 116.2 24 = Export Types =
Vincent Massol 1.1 25
Vincent Massol 116.2 26 == ODT Export ==
27
Marius Dumitru Florea 114.2 28 If you configure your wiki to work with an office server ([[LibreOffice>>http://www.libreoffice.org/]] or [[OpenOffice>>http://www.openoffice.org/]]) as described in the [[Office Importer Application>>extensions:Extension.Office Importer Application]] you'll notice a new entry in the Export Modal (as long as you are connected to the office server). Only single-page ODT export is supported at the moment.
29
Vincent Massol 90.1 30 {{info}}
Marius Dumitru Florea 114.2 31 You can tweak the export URL to export to other office formats supported by your office server. For instance ##/xwiki/bin/export/Sandbox/WebHome?format=doc## exports ##Sandbox.WebHome## page to Microsoft Word's proprietary DOC format.
Vincent Massol 90.1 32 {{/info}}
Sorin Burjan 34.1 33
Vincent Massol 116.2 34 == PDF Export ==
Vincent Massol 93.4 35
Marius Dumitru Florea 114.2 36 {{version since="14.10"}}
37 Support for PDF export is provided by the [[PDF Export Application>>extensions:Extension.PDF Export Application.WebHome]] which is bundled by default in XWiki Standard. Checkout its documentation for more information.
38 {{/version}}
Vincent Massol 90.1 39
Vincent Massol 118.2 40 === Old PDF Export ===
41
Marius Dumitru Florea 114.2 42 {{version before="14.10"}}
Vincent Massol 118.2 43 On older versions of XWiki the PDF export was implemented using Apache FOP (Formatting Objects Processor). This implementation is replaced, by default, by the browser-based (client-side) PDF export provided by the PDF Export Application. It is considered deprecated and not recommended to be used. You can restore the old implementation, if you want, from the PDF Export Application configuration.
Marius Dumitru Florea 114.2 44
45 The old PDF Export has a UI interface to manage the export:
46
Silvia Macovei 40.1 47 {{image reference="pdfExportOptions.png"/}}
Sorin Burjan 34.1 48
Vincent Massol 116.3 49 === Advanced ===
Vincent Massol 3.1 50
Vincent Massol 116.3 51 A PDF export can also be triggered by using the following type of URLs:
52
Raluca Moisa 29.2 53 {{code language="none"}}
54 http://server/xwiki/bin/export/Space/Page?format=pdf
55 {{/code}}
Silvia Macovei 12.1 56
Vincent Massol 116.5 57 The old PDF export (unlike the new one) doesn't provide an UI for multipage export. However it's possible to export a set of pages, using the following type of URL:
Vincent Massol 32.1 58
Thibaut Camberlin 31.1 59 {{code language="none"}}
Vincent Massol 32.1 60 http://server/xwiki/bin/export/Space/Page?format=pdf&pages=Admin.Page_A&pages=Admin.Page_B&pages=Admin.Page_C...
Thibaut Camberlin 31.1 61 {{/code}}
62
Vincent Massol 3.1 63 In addition the following URL parameters can be added to refine what should be exported:
Thomas Mortagne 18.1 64
Manuel Smeria 40.3 65 * ##pages##: there can be several such parameters, each representing a page to export. For example: ##&pages=Main.WebHome&pages=Blog.WebHome##.
66 {{info}}When ##pages## parameters are specified, the current document specified in the URL isn't used{{/info}}
Silvia Macovei 12.3 67 * ##includechilds##: the value is a number specifying the depth of children pages to include in the PDF export. For example ##&includechilds=2## will include all children pages of the page to export, all its children (i.e. pages which have the page as its parent) and all the children's children.
Silvia Macovei 12.7 68 * ##includelinks##: the value is a number specifying the depth of linked pages to include in the PDF export. For example ##&includelinks=2## will include all pages linked from the page to export and the links in the linked pages.
69 * ##pagebreaks##: if the value is set to ##1## then a page break is inserted between all exported pages.
Silvia Macovei 12.3 70 * ##comments##: if set to ##1## then also export the comments.
71 * ##attachments##: if set to ##1## then also export the attachments (only if they are images).
72
Guillaume Lerouge 17.1 73 {{info}}
Vincent Massol 65.3 74 Notes:
Sakthivel Muthu 75.1 75
Thomas Mortagne 117.1 76 * It's also possible to [[customize how the generated PDF looks like>>Documentation.AdminGuide.Configuration#HCustomizingthePDFexportLook26Feel]].
Guillaume Lerouge 17.1 77 {{/info}}
Marius Dumitru Florea 114.2 78 {{/version}}
Vincent Massol 3.1 79
Vincent Massol 116.2 80 == RTF Export ==
Vincent Massol 4.2 81
Marius Dumitru Florea 114.2 82 The RTF export works in the same manner as the ODT export, so it also requires an office server to be configured and connected. Similarly, only single-page RTF export is supported at the moment.
Vincent Massol 4.1 83
Vincent Massol 116.2 84 == XAR Export ==
Vincent Massol 1.1 85
Thomas Mortagne 117.1 86 The XAR export allows exporting pages in the internal XML format used by XWiki. This is the format that you can use to [[Import/Export>>Documentation.AdminGuide.ImportExport]] pages and applications into/from XWiki instances.
Silvia Macovei 12.3 87
Marius Dumitru Florea 114.3 88 Multipage XAR export is supported, so if the current page is nested then the Export Tree Modal is shown upon selecting the XAR format. From there you can chose the child pages that you want to export along with the current page. You can filter the tree to exclude extension pages (e.g. //Created pages//, //Created and modified pages// or //All pages//). Check out the [[Administration Application>>extensions:Extension.Administration Application#HExport]] for more information about the export tree.
Vincent Massol 4.1 89
Guillaume Delhumeau 63.1 90 {{info}}
91 Naturally, this tree is not displayed if the current page is terminal, which means it cannot have children.
92 {{/info}}
93
Eduard Moraru 86.3 94 Notes:
95
Marius Dumitru Florea 114.3 96 * The "XAR" export format option will only appear if you are logged in with an admin user.
Eduard Moraru 86.3 97 * To import back a XAR file, you also need to be an admin user and use the [[Import section in Administration>>Documentation.AdminGuide.ImportExport]]
98
Vincent Massol 116.2 99 === Advanced ===
Guillaume Delhumeau 65.1 100
Guillaume Delhumeau 63.1 101 You could also use the following type of URL (note that the ##Space/Page## part in the URL is ignored and the Export action only takes into account the ##pages## Query String parameter):
102
Raluca Moisa 29.2 103 {{code language="none"}}
Thomas Mortagne 48.1 104 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Space.Page
Raluca Moisa 29.2 105 {{/code}}
Silvia Macovei 12.1 106
Vincent Massol 4.1 107 In addition the following URL parameters can be added to refine what should be exported:
Silvia Macovei 12.1 108
Vincent Massol 106.2 109 * ##pages##: there can be several such parameters, each representing a pattern of pages to export. Here is the format of an export pattern:(((
Marius Dumitru Florea 49.1 110 {{code language="none"}}
111 wikiid:pageFullNamePattern
112 {{/code}}
Thomas Mortagne 47.1 113
Marius Dumitru Florea 49.1 114 * ##wikiid##: the name of the wiki from where to get the wiki pages
Vincent Massol 42.1 115 * ##pageFullNamePattern##: the full name pattern of the page based on [[SQL "LIKE" comparator>>http://www.techonthenet.com/sql/like.php]]. Remember that the character {{{%}}} has to be converted in {{{%25}}} in an URL.
Marius Dumitru Florea 50.1 116 )))
Vincent Massol 106.4 117 * ##excludes##: there can also be several such parameter, each representing a pattern, or list of pages associated to a ##pages## pattern. The format is the same as for pages except all special characters must be encoding in the URL. Also, as the parameter is attached to a ##pages## parameter, be careful with the order. See the examples below.
Vincent Massol 56.3 118 * ##name##: the name of the exported XAR file. If not specified, a default name will be used.
Marius Dumitru Florea 50.1 119 * ##history##: if defined then also export the page's history. Example: ##&history=true##
120 * ##backup##: if defined then the XWiki document author of each page remains the same as the one exported when reimporting into an XWiki instance.
121 * ##author##: if defined, specifies the author's name in the XAR export which can later be viewed when reimporting into an XWiki instance.
122 * ##description##: if defined, gives a description added to the XAR export which can later be viewed when reimporting into an XWiki instance.
123 * ##license##: if defined, specifies the license to the XAR export which can later be viewed when reimporting into an XWiki instance.
124 * ##version##: if defined, specifies the version of the export to the XAR.
Vincent Massol 42.1 125
126 Some examples:
Thomas Mortagne 47.1 127
Marius Dumitru Florea 49.1 128 * Exports all pages in the ##Main## space:(((
Oana Florea 89.2 129 {{code language="none"}}
130 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25
131 {{/code}}
Vincent Massol 42.1 132 )))
133 * Exports all pages in the current wiki:(((
Thomas Mortagne 47.1 134 {{code language="none"}}
135 http://server/xwiki/bin/export/Space/Page?format=xar&pages=%25.%25
136 {{/code}}
Vincent Massol 42.1 137 )))
138 * Exports the pages ##Main.WebHome## and ##Blog.WebHome##:(((
Thomas Mortagne 47.1 139 {{code language="none"}}
140 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.WebHome&pages=Blog.WebHome
141 {{/code}}
Simon Urli 86.1 142 )))
Simon Urli 83.2 143 * Exports all pages in the ##Main## space except pages under ##Main.Space1## space, and all pages under ##Other## space:(((
Oana Florea 89.2 144 {{code language="none"}}
145 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
146 {{/code}}
Simon Urli 83.2 147 )))
148 * Exports all pages in the ##subwiki:Main## space except a page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##:(((
149 {{code language="none"}}
150 http://server/xwiki/bin/export/Space/Page?format=xar&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
151 {{/code}}
152 )))
Simon Urli 85.1 153 * Exports all pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
154 {{code language="none"}}
155 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
156 {{/code}}
157 )))
Vincent Massol 4.1 158
Vincent Massol 116.2 159 == HTML Export ==
Vincent Massol 1.1 160
Iulia Balan 55.1 161 The HTML export allows exporting wiki pages as static HTML pages independent from the XWiki engine. All pages are exported in view mode. That way you can export a whole space containing documentation and access it on your computer without any web server. The export is done with the current skin.
162
Marius Dumitru Florea 114.3 163 Multipage HTML export is supported, so if the current page is nested then the Export Tree Modal is shown upon selecting the HTML format. From there you can chose the child pages that you want to export along with the current page. You can filter the tree to exclude extension pages (e.g. //Created pages//, //Created and modified pages// or //All pages//). Check out the [[Administration Application>>extensions:Extension.Administration Application#HExport]] for more information about the export tree.
Thomas Mortagne 9.1 164
Vincent Massol 68.1 165 The HTML export is packaged as a ZIP. Here's an example of its content and how it's organized:
166
167 {{image reference="htmlexport-content.png"/}}
168
169 A basic index page is also generated and provides a list (and links) of all pages that have been exported. For example:
170
171 {{image reference="htmlexport-index.png"/}}
172
Vincent Massol 116.2 173 === Advanced ===
Guillaume Delhumeau 64.1 174
175 You could also use the following type of URL:
176
Raluca Moisa 29.2 177 {{code language="none"}}
178 http://server/xwiki/bin/export/Space/Page?format=html
179 {{/code}}
Silvia Macovei 12.1 180
Thomas Mortagne 5.1 181 In addition the following URL parameters can be added to refine what should be exported:
Silvia Macovei 12.1 182
Silvia Macovei 12.6 183 * ##name##: the name of the generated Zip file.
184 * ##description##: the comment in the generated Zip file.
Vincent Massol 119.1 185 * ##pages##: there can be several such parameters, each representing a pattern of page references to export. Here is the format of an export pattern:(((
Marius Dumitru Florea 49.1 186 {{code language="none"}}
Vincent Massol 119.1 187 wikiid:pageFullNamePattern
Marius Dumitru Florea 49.1 188 {{/code}}
Thomas Mortagne 48.1 189
Vincent Massol 119.1 190 * ##wikiid##: (optional) the name of the wiki from where to get the wiki pages. You don't need to specify it if you're targeting pages from the current wiki.
191 * ##pageFullNamePattern##: the full name pattern of the page based on [[SQL "LIKE" comparator>>http://www.techonthenet.com/sql/like.php]]. Remember that the {{{%}}} character has to be converted in {{{%25}}} in an URL. More precisely, a page format is {{code language="none"}}(space id1).(space id2).(space idN).(page id){{/code}}.
Marius Dumitru Florea 50.1 192 )))
Vincent Massol 118.1 193 * ##excludes##: there can also be several such parameter, one after each ##pages##parameter, each representing a pattern, or list of pages associated to the ##pages## pattern. The format is the same as for pages except all special characters must be encoded in the URL.
Silvia Macovei 12.3 194
Vincent Massol 42.1 195 Some examples:
Thomas Mortagne 47.1 196
Raluca Moisa 29.2 197 * Exports the current page from the current wiki:(((
Oana Florea 89.2 198 {{code language="none"}}
199 http://server/xwiki/bin/export/Space/Page?format=html
200 {{/code}}
Silvia Macovei 18.2 201 )))
Raluca Moisa 29.2 202 * Exports the current page from the current wiki in ##packagename.zip##:(((
203 {{code language="none"}}
204 http://server/xwiki/bin/export/Space/Page?format=html&name=packagename
205 {{/code}}
Silvia Macovei 18.2 206 )))
Raluca Moisa 29.2 207 * Exports all the pages from the ##Space## space as well as the ##Space2.Page## page from the current wiki:(((
Oana Florea 89.2 208 {{code language="none"}}
209 http://server/xwiki/bin/export/Space/Page?format=html&pages=Space.%25&pages=Space2.Page
210 {{/code}}
Silvia Macovei 18.2 211 )))
Raluca Moisa 29.2 212 * Exports all the pages from the ##Space## space located in the ##wiki2## subwiki:(((
213 {{code language="none"}}
214 http://server/xwiki/bin/export/Space/Page?format=html&pages=wiki2:Space.%25
215 {{/code}}
Silvia Macovei 18.2 216 )))
Simon Urli 86.1 217 * Exports all pages in the ##Main## space except pages under ##Main.Space1## space, and all pages under ##Other## space:(((
Oana Florea 89.2 218 {{code language="none"}}
219 http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
220 {{/code}}
Simon Urli 86.1 221 )))
222 * Exports all pages in the ##subwiki:Main## space except a page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##:(((
223 {{code language="none"}}
224 http://server/xwiki/bin/export/Space/Page?format=html&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
225 {{/code}}
226 )))
227 * Exports all pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
228 {{code language="none"}}
229 http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
230 {{/code}}
231 )))
Vincent Massol 118.1 232 * Exports all pages from the current wiki:(((
233 {{code language="none"}}
234 http://server/xwiki/bin/export/Space/Page?format=html&pages=%25.%25
235 {{/code}}
236 )))
237 * Exports all pages from the "somewiki" wiki:(((
238 {{code language="none"}}
239 http://server/xwiki/bin/export/Space/Page?format=html&pages=somewiki:%25.%25
240 {{/code}}
241 )))
242

Get Connected