Wiki source code of Exports

Version 92.1 by Vincent Massol on 2022/07/19

Hide last authors
Raluca Moisa 29.2 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
Vincent Massol 1.1 4
Vincent Massol 65.2 5 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, then click "Export as PDF".
Silvia Macovei 16.1 6
Silvia Macovei 46.1 7 {{image reference="ExportFlamingo.png"/}}
Sorin Burjan 25.1 8
Thomas Mortagne 78.1 9 {{image reference="ExportFlamingoPDF.png"/}}
Silvia Macovei 16.1 10
Silvia Macovei 46.1 11 // "Export" as it appears using the Flamingo Skin. //
12
Vincent Massol 74.3 13 In addition, Admins can also export all the pages of the wiki through the [[Import/Export Admin feature>>platform:AdminGuide.ImportExport]].
Vincent Massol 65.2 14
Raluca Moisa 29.2 15 {{warning}}
Thomas Mortagne 70.1 16 Right now we don't have any user interface for exporting an arbitrary set of wiki pages. This is a [[work in progress>>https://jira.xwiki.org/browse/XWIKI-1289]]. However it's possible to export a set of pages by following the instructions below for each export format, through some custom URLs.
Raluca Moisa 29.2 17 {{/warning}}
Vincent Massol 3.1 18
Silvia Macovei 18.2 19 = PDF Export =
Vincent Massol 1.1 20
Vincent Massol 90.1 21 {{info}}
22 {{version since="14.2"}}
23 An experimental [[client-side PDF export extension>>extensions:Extension.PDF Export Application.WebHome]] is available and is meant to replace the current server-side one.
24 {{/version}}
25 {{/info}}
Sorin Burjan 34.1 26
Vincent Massol 90.1 27 The PDF Export has a UI interface to manage the export:
28
Silvia Macovei 40.1 29 {{image reference="pdfExportOptions.png"/}}
Sorin Burjan 34.1 30
Vincent Massol 90.1 31 To export a page as PDF, use the action menu as explained above or use the following type of URL:
Vincent Massol 3.1 32
Raluca Moisa 29.2 33 {{code language="none"}}
34 http://server/xwiki/bin/export/Space/Page?format=pdf
35 {{/code}}
Silvia Macovei 12.1 36
Vincent Massol 32.1 37 To export several pages as PDF use the following type of URL (see the ##pages## parameter below):
38
Thibaut Camberlin 31.1 39 {{code language="none"}}
Vincent Massol 32.1 40 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 41 {{/code}}
42
Vincent Massol 3.1 43 In addition the following URL parameters can be added to refine what should be exported:
Thomas Mortagne 18.1 44
Manuel Smeria 40.3 45 * ##pages##: there can be several such parameters, each representing a page to export. For example: ##&pages=Main.WebHome&pages=Blog.WebHome##.
46 {{info}}When ##pages## parameters are specified, the current document specified in the URL isn't used{{/info}}
Silvia Macovei 12.3 47 * ##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 48 * ##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.
49 * ##pagebreaks##: if the value is set to ##1## then a page break is inserted between all exported pages.
Silvia Macovei 12.3 50 * ##comments##: if set to ##1## then also export the comments.
51 * ##attachments##: if set to ##1## then also export the attachments (only if they are images).
52
Guillaume Lerouge 17.1 53 {{info}}
Vincent Massol 65.3 54 Notes:
Sakthivel Muthu 75.1 55
Vincent Massol 65.3 56 * It's also possible to [[customize how the generated PDF looks like>>platform:AdminGuide.Configuration#HCustomizingthePDFexportLook26Feel]].
57 * There's also a contributed panel that provides [[an UI for PDF Export options.>>extensions:Extension.PDF Export Panel Application]]
Guillaume Lerouge 17.1 58 {{/info}}
Vincent Massol 3.1 59
Sorin Burjan 35.2 60 = ODT Export =
61
Iulia Balan 54.1 62 {{info}}
Ecaterina Moraru (Valica) 74.1 63 ODT Export is available starting with XWiki 6.3.
Iulia Balan 54.1 64 {{/info}}
Iulia Balan 53.1 65
Silvia Macovei 46.1 66 {{image reference="ExportFlamingoPDF.png"/}}
Sorin Burjan 35.2 67
Ecaterina Moraru (Valica) 73.1 68 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 popup (as long as you are connected to the office server).
Sorin Burjan 35.2 69
Vincent Massol 41.1 70 {{info}}
71 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.
72 {{/info}}
73
Silvia Macovei 18.2 74 = RTF Export =
Vincent Massol 4.2 75
Vincent Massol 41.1 76 The RTF export works in the same manner as the PDF export.
Vincent Massol 4.1 77
Vincent Massol 41.1 78 {{info}}XWiki 6.2{{/info}} Similar to the ODT export, you need an office server started to see the RTF export option.
79
Silvia Macovei 18.2 80 = XAR Export =
Vincent Massol 1.1 81
Ludovic Dubost 14.1 82 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>>platform:AdminGuide.ImportExport]] pages and applications into/from XWiki instances.
Silvia Macovei 12.3 83
Guillaume Delhumeau 63.1 84 To export a page as a XAR use the action menu as explained above:
Vincent Massol 4.1 85
Guillaume Delhumeau 63.1 86 (((
Oana Florea 89.2 87 {{image reference="ExportFlamingoXAR.png"/}}
Guillaume Delhumeau 63.1 88 )))
89
Oana Florea 89.2 90 A tree will be displayed to allow you to chose children pages that you want to export along with the current page. Starting with XWiki 11.10 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.
Guillaume Delhumeau 63.1 91
92 {{info}}
93 Naturally, this tree is not displayed if the current page is terminal, which means it cannot have children.
94 {{/info}}
95
Eduard Moraru 86.3 96 Notes:
97
98 * The "Export XAR" option will only appear if you are logged in with an admin user.
99 * To import back a XAR file, you also need to be an admin user and use the [[Import section in Administration>>Documentation.AdminGuide.ImportExport]]
100
Guillaume Delhumeau 65.1 101 == Advanced ==
102
Guillaume Delhumeau 63.1 103 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):
104
Raluca Moisa 29.2 105 {{code language="none"}}
Thomas Mortagne 48.1 106 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Space.Page
Raluca Moisa 29.2 107 {{/code}}
Silvia Macovei 12.1 108
Vincent Massol 4.1 109 In addition the following URL parameters can be added to refine what should be exported:
Silvia Macovei 12.1 110
Thomas Mortagne 47.1 111 * ##pages##: there can be several such parameters, each representing a pattern of pages to export (prior to XWiki 6.3, only fixed page names could be specified, not patterns). Here is the format of an export pattern:(((
Marius Dumitru Florea 49.1 112 {{code language="none"}}
113 wikiid:pageFullNamePattern
114 {{/code}}
Thomas Mortagne 47.1 115
Marius Dumitru Florea 49.1 116 * ##wikiid##: the name of the wiki from where to get the wiki pages
Vincent Massol 42.1 117 * ##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 118 )))
Simon Urli 85.1 119 * (Since {{info}}10.9RC1{{/info}}) ##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 120 * ##name##: the name of the exported XAR file. If not specified, a default name will be used.
Marius Dumitru Florea 50.1 121 * ##history##: if defined then also export the page's history. Example: ##&history=true##
122 * ##backup##: if defined then the XWiki document author of each page remains the same as the one exported when reimporting into an XWiki instance.
123 * ##author##: if defined, specifies the author's name in the XAR export which can later be viewed when reimporting into an XWiki instance.
124 * ##description##: if defined, gives a description added to the XAR export which can later be viewed when reimporting into an XWiki instance.
125 * ##license##: if defined, specifies the license to the XAR export which can later be viewed when reimporting into an XWiki instance.
126 * ##version##: if defined, specifies the version of the export to the XAR.
Vincent Massol 42.1 127
128 Some examples:
Thomas Mortagne 47.1 129
Marius Dumitru Florea 49.1 130 * Exports all pages in the ##Main## space:(((
Oana Florea 89.2 131 {{code language="none"}}
132 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25
133 {{/code}}
Vincent Massol 42.1 134 )))
135 * Exports all pages in the current wiki:(((
Thomas Mortagne 47.1 136 {{code language="none"}}
137 http://server/xwiki/bin/export/Space/Page?format=xar&pages=%25.%25
138 {{/code}}
Vincent Massol 42.1 139 )))
140 * Exports the pages ##Main.WebHome## and ##Blog.WebHome##:(((
Thomas Mortagne 47.1 141 {{code language="none"}}
142 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.WebHome&pages=Blog.WebHome
143 {{/code}}
Simon Urli 86.1 144 )))
145
146 Since {{info}}10.9RC1{{/info}}:
147
Simon Urli 83.2 148 * Exports all pages in the ##Main## space except pages under ##Main.Space1## space, and all pages under ##Other## space:(((
Oana Florea 89.2 149 {{code language="none"}}
150 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
151 {{/code}}
Simon Urli 83.2 152 )))
153 * Exports all pages in the ##subwiki:Main## space except a page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##:(((
154 {{code language="none"}}
155 http://server/xwiki/bin/export/Space/Page?format=xar&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
156 {{/code}}
157 )))
Simon Urli 85.1 158 * Exports all pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
159 {{code language="none"}}
160 http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
161 {{/code}}
162 )))
Vincent Massol 4.1 163
Silvia Macovei 18.2 164 = HTML Export =
Vincent Massol 1.1 165
Iulia Balan 55.1 166 {{info}}
167 HTML Export is available starting with XWiki Entreprise 6.3.
168 {{/info}}
Silvia Macovei 12.3 169
Iulia Balan 55.1 170 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.
171
Guillaume Delhumeau 64.1 172 To export a page as HTML use the action menu as explained above:
Thomas Mortagne 9.1 173
Vincent Massol 68.1 174 {{image reference="ExportFlamingoXAR.png"/}}
Guillaume Delhumeau 64.1 175
176 A tree will be displayed to allow you to chose children pages that you want to export along with the current page.
177
Vincent Massol 68.1 178 The HTML export is packaged as a ZIP. Here's an example of its content and how it's organized:
179
180 {{image reference="htmlexport-content.png"/}}
181
182 A basic index page is also generated and provides a list (and links) of all pages that have been exported. For example:
183
184 {{image reference="htmlexport-index.png"/}}
185
Guillaume Delhumeau 64.1 186 == Advanced ==
187
188 You could also use the following type of URL:
189
Raluca Moisa 29.2 190 {{code language="none"}}
191 http://server/xwiki/bin/export/Space/Page?format=html
192 {{/code}}
Silvia Macovei 12.1 193
Thomas Mortagne 5.1 194 In addition the following URL parameters can be added to refine what should be exported:
Silvia Macovei 12.1 195
Silvia Macovei 12.6 196 * ##name##: the name of the generated Zip file.
197 * ##description##: the comment in the generated Zip file.
Thomas Mortagne 48.1 198 * ##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 199 {{code language="none"}}
200 wikiid:pageFullNamePattern
201 {{/code}}
Thomas Mortagne 48.1 202
Marius Dumitru Florea 49.1 203 * ##wikiid##: the name of the wiki from where to get the wiki pages
Vincent Massol 42.1 204 * ##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 205 )))
Simon Urli 86.1 206 * (Since {{info}}10.9RC1{{/info}}) ##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.
Silvia Macovei 12.3 207
Vincent Massol 42.1 208 Some examples:
Thomas Mortagne 47.1 209
Raluca Moisa 29.2 210 * Exports the current page from the current wiki:(((
Oana Florea 89.2 211 {{code language="none"}}
212 http://server/xwiki/bin/export/Space/Page?format=html
213 {{/code}}
Silvia Macovei 18.2 214 )))
Raluca Moisa 29.2 215 * Exports the current page from the current wiki in ##packagename.zip##:(((
216 {{code language="none"}}
217 http://server/xwiki/bin/export/Space/Page?format=html&name=packagename
218 {{/code}}
Silvia Macovei 18.2 219 )))
Raluca Moisa 29.2 220 * Exports all the pages from the ##Space## space as well as the ##Space2.Page## page from the current wiki:(((
Oana Florea 89.2 221 {{code language="none"}}
222 http://server/xwiki/bin/export/Space/Page?format=html&pages=Space.%25&pages=Space2.Page
223 {{/code}}
Silvia Macovei 18.2 224 )))
Raluca Moisa 29.2 225 * Exports all the pages from the ##Space## space located in the ##wiki2## subwiki:(((
226 {{code language="none"}}
227 http://server/xwiki/bin/export/Space/Page?format=html&pages=wiki2:Space.%25
228 {{/code}}
Silvia Macovei 18.2 229 )))
Simon Urli 86.1 230
231 Since {{info}}10.9RC1{{/info}}:
232
233 * Exports all pages in the ##Main## space except pages under ##Main.Space1## space, and all pages under ##Other## space:(((
Oana Florea 89.2 234 {{code language="none"}}
235 http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
236 {{/code}}
Simon Urli 86.1 237 )))
238 * Exports all pages in the ##subwiki:Main## space except a page named ##subwiki:Main.Excluded&Other## and ##subwiki:Main.WebHome##:(((
239 {{code language="none"}}
240 http://server/xwiki/bin/export/Space/Page?format=html&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
241 {{/code}}
242 )))
243 * Exports all pages in the ##Main## space and all in the ##Other## space except ##Other.Excluded## (see the empty excludes for respecting the order):(((
244 {{code language="none"}}
245 http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
246 {{/code}}
247 )))

Get Connected