Export whole wiki in cli (pdf, rtf, txt)

Is there a way to to export the entire wiki to a human-readable format (for printing a dead-tree paper copy of our wiki) via the command-line interface?

Consider an organization with an enormous wiki. It’s thousands of pages with dozens-deep child pages. We have our playbooks stored in our wiki, including our playbooks for provisioning the wiki itself. For disaster recovery purposes, we need to have a paper backup of our wiki.

In browsing the xwiki site, I saw a few ways to do this, none of which work for achieving the above.

XAR Export

In the Wiki Administration section of the xwiki WUI, you can create a XAR-Format export of the wiki.

This XAR format is a zip of machine-readable xml files. This is not ideal because it’s not reasonable to print (pdf, rtf, or txt would be more appropriate than xml)

Exports

Every use can click the “Export” button on a given page to export the page to pdf, rtf, odt, html, or xar formats. This redirects the user to the following page:

We found that we can increase the scope of the export by appending includechilds=X to the GET variables

Unfortunately, this would be a massive export, and it results in a web server error (504 gateway timeout). It really doesn’t make sense to go through the web server to do this.

If we could execute this on the CLI directly, it would be perfect for our needs.

DB/Files Backups

This is the only option I found documented on how to get the data from CLI, but it also just dumps the data in computer-readable formats. It won’t work for us because it’s not reasonable to print on paper.

Seems to me it would be better to store a working version of XWiki in a different site location (in that manner you have the data + the software to view them) but YMMV :wink:

This is supposed to work. The HTML Export has a UI to export several pages: https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/Exports#HHTMLExport

XWiki still needs to implement a UI to do the same for PDF Export. See Loading...

What we need to do is to use an XWiki Job to perform that export, in the same way as we do for the LaTeX Export that we implemented recently: https://extensions.xwiki.org/xwiki/bin/view/Extension/LaTeX/Exporter/#HProgress

Note that you should be able to use curl to call that URL and it should generate a PDF.