Exports

Last modified by Vincent Massol on 2024/01/05

Usage

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.

ExportFlamingo.png

This opens the Export Modal from where you can select the export format.

exportDialog.png

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:

  • 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

    exportTreeModal.png

  • otherwise the user is taken directly to the dedicated page for the selected export format

In addition, Admins can also export all the pages of the wiki through the Import/Export Admin feature.

Export Types

ODT Export

If you configure your wiki to work with an office server (LibreOffice or OpenOffice) as described in the 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.

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.

PDF Export

XWiki 14.10+ Support for PDF export is provided by the PDF Export Application which is bundled by default in XWiki Standard. Checkout its documentation for more information.

XWiki <14.10 

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. You can restore the old implementation, if you want, from the PDF Export Application configuration.

The old PDF Export has a UI interface to manage the export:

pdfExportOptions.png

Advanced

A PDF export can also be triggered by using the following type of URLs:

http://server/xwiki/bin/export/Space/Page?format=pdf

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:

http://server/xwiki/bin/export/Space/Page?format=pdf&pages=Admin.Page_A&pages=Admin.Page_B&pages=Admin.Page_C...

In addition the following URL parameters can be added to refine what should be exported:

  • pages: there can be several such parameters, each representing a page to export. For example: &pages=Main.WebHome&pages=Blog.WebHome.
    When pages parameters are specified, the current document specified in the URL isn't used
  • 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.
  • 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.
  • pagebreaks: if the value is set to 1 then a page break is inserted between all exported pages.
  • comments: if set to 1 then also export the comments.
  • attachments: if set to 1 then also export the attachments (only if they are images).

Notes:

RTF Export

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.

XAR Export

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 pages and applications into/from XWiki instances.

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 pagesCreated and modified pages or All pages). Check out the Administration Application for more information about the export tree.

Naturally, this tree is not displayed if the current page is terminal, which means it cannot have children.

Notes:

  • The "XAR" export format option will only appear if you are logged in with an admin user.
  • To import back a XAR file, you also need to be an admin user and use the Import section in Administration

Advanced

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):

http://server/xwiki/bin/export/Space/Page?format=xar&pages=Space.Page

In addition the following URL parameters can be added to refine what should be exported:

  • pages: there can be several such parameters, each representing a pattern of pages to export. Here is the format of an export pattern:
    wikiid:pageFullNamePattern
    • wikiid: the name of the wiki from where to get the wiki pages
    • pageFullNamePattern: the full name pattern of the page based on SQL "LIKE" comparator. Remember that the character % has to be converted in %25 in an URL.
  • 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.
  • name: the name of the exported XAR file. If not specified, a default name will be used.
  • history: if defined then also export the page's history. Example: &history=true
  • backup: if defined then the XWiki document author of each page remains the same as the one exported when reimporting into an XWiki instance.
  • author: if defined, specifies the author's name in the XAR export which can later be viewed when reimporting into an XWiki instance.
  • description: if defined, gives a description added to the XAR export which can later be viewed when reimporting into an XWiki instance.
  • license: if defined, specifies the license to the XAR export which can later be viewed when reimporting into an XWiki instance.
  • version: if defined, specifies the version of the export to the XAR.

Some examples:

  • Exports all pages in the Main space:
    http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25
  • Exports all pages in the current wiki:
    http://server/xwiki/bin/export/Space/Page?format=xar&pages=%25.%25
  • Exports the pages Main.WebHome and Blog.WebHome:
    http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.WebHome&pages=Blog.WebHome
  • Exports all pages in the Main space except pages under Main.Space1 space, and all pages under Other space:
    http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
  • Exports all pages in the subwiki:Main space except a page named subwiki:Main.Excluded&Other and subwiki:Main.WebHome:
    http://server/xwiki/bin/export/Space/Page?format=xar&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
  • Exports all pages in the Main space and all in the Other space except Other.Excluded (see the empty excludes for respecting the order):
    http://server/xwiki/bin/export/Space/Page?format=xar&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded

HTML Export

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.

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 pagesCreated and modified pages or All pages). Check out the Administration Application for more information about the export tree.

The HTML export is packaged as a ZIP. Here's an example of its content and how it's organized:

htmlexport-content.png

A basic index page is also generated and provides a list (and links) of all pages that have been exported. For example:

htmlexport-index.png

Advanced

You could also use the following type of URL:

http://server/xwiki/bin/export/Space/Page?format=html

In addition the following URL parameters can be added to refine what should be exported: 

  • name: the name of the generated Zip file.
  • description: the comment in the generated Zip file.
  • pages: there can be several such parameters, each representing a pattern of pages to export. Here is the format of an export pattern:
    wikiid):pageFullNamePattern
    • wikiid: the name of the wiki from where to get the wiki pages
    • pageFullNamePattern: the full name pattern of the page based on SQL "LIKE" comparator. Remember that the character % has to be converted in %25 in an URL. More precisely, a page format is (space id1).(space id2).(space idN).(page id).
  • excludes: there can also be several such parameter, one after each pagesparameter, 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.

Some examples:

  • Exports the current page from the current wiki:
    http://server/xwiki/bin/export/Space/Page?format=html
  • Exports the current page from the current wiki in packagename.zip:
    http://server/xwiki/bin/export/Space/Page?format=html&name=packagename
  • Exports all the pages from the Space space as well as the Space2.Page page from the current wiki:
    http://server/xwiki/bin/export/Space/Page?format=html&pages=Space.%25&pages=Space2.Page
  • Exports all the pages from the Space space located in the wiki2 subwiki:
    http://server/xwiki/bin/export/Space/Page?format=html&pages=wiki2:Space.%25
  • Exports all pages in the Main space except pages under Main.Space1 space, and all pages under Other space:
    http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=Main.Space1.%25&pages=Other.%25
  • Exports all pages in the subwiki:Main space except a page named subwiki:Main.Excluded&Other and subwiki:Main.WebHome:
    http://server/xwiki/bin/export/Space/Page?format=html&pages=subwiki:Main.%25&excludes=subwiki%3AMain.Excluded%26Other&subwiki%3AMain.WebHome
  • Exports all pages in the Main space and all in the Other space except Other.Excluded (see the empty excludes for respecting the order):
    http://server/xwiki/bin/export/Space/Page?format=html&pages=Main.%25&excludes=&pages=Other.%25&excludes=Other.Excluded
  • Exports all pages from the current wiki:
    http://server/xwiki/bin/export/Space/Page?format=html&pages=%25.%25
  • Exports all pages from the "somewiki" wiki:
    http://server/xwiki/bin/export/Space/Page?format=html&pages=somewiki:%25.%25
Tags:
   

Get Connected