17

3

I want to use the wiki to generate documentation, but I need to export it so I can print it / make it PDF / include it in a build process. Can this be done?

Fog Creek Case FC718328

flag

1 Answer

4

Print to PDF We recommend viewing the wiki article in your browser and using print to pdf. You can adjust your template for the wiki to format it best for printing. On Mac, choose Save to PDF... from the print dialog box. On Windows, grab a free tool such as CutePDF.

Programmatic exports. If you need to export many pages or export programmatically, there are many options, all fairly complex. Here are some basics:

  • Wiki articles are stored in the database as raw html - good
  • Intra-wiki and case links are relative - tricky
  • Embedded images and attachments' URLs can be accessed programmatically by adding an XML API logon toke to the end - good
  • If you use plugins in your wiki such as the Table of Contents or other Wikiblock plugins, these only put a placeholder in the HTML which is dynamically replaced on render - tricky

Some things to try:

  • Have your live documentation site use the XML API to pull the article's HTML when the user requests a document on your site. The script on your site would then need to fix relative links. You would also need to make sure the wiki is publicly accessible so images and attachments work, or store an API logon token in the script on your site for fetching them.
  • Spider the wiki either as a user would, or better with the XML API. convert links, etc, apply styles and save the documents in your desired format. See this answer for an outline.

To those who can edit: feel free to add any accumulated knowledge from your own export efforts

link|flag
It becomes difficult if one wants a PDF export with links and the print layout. On Windows. The Print to PDF option (with e.g. Acrobat) gets a print layout, but doesn't keep links. Using Acrobat Pros convert HTML to PDF keeps the links, but doesn't use the print laoyut. Safari on OSX can generate a PDF with links and print layout, but that's OSX. I see the need for a plugin... – Martin Schröder May 19 2011 at 8:51

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.