PDF Export for MediaWiki

There are lots of possibilities for exporting MediaWiki articles as PDF documents.
Some further developments I want to outline here:

Wiki as the central source of knowledge

There are many good reasons for supplying a Wiki with a PDF export facility:

  • Extracts, logs, check lists or short descriptions may be needed on paper or may need to be sent via e-mail.
  • Whole topics or areas of knowledge may need to be made into brochures or books so they can be available, for example, on the website for users, service providers and partners, or offline for field staff.
  • Intermediary versions of handbooks might need to be kept, for example, to supplement contracts and invitations to tender or as documents giving a basis for auditing.

Using a wiki as a central medium here has the obvious advantage that rather than having innumerable PDF documents flying around, the texts can be developed in the wiki and kept up to date. The PDF export function will then give out the most up to date version.

How to create my first PDF export

If you want to add a PDF export facility to a wiki, first work out whether you just want the readers to be able to export individual articles as PDFs or if you want to give them the opportunity to put together a selection of articles in a “book”. The second option is a more technologically complex.

Furthermore, decide whether the firm’s CI should be used and how far you want to go with providing the user templates. Will the PDFs always have the same layout? Do they have, for example, the same coversheet? As soon as this is decided you can get started.

MediaWiki has no PDF export facility in the standard software. However, you can find a whole set of PDF extensions at MediaWiki.org with individual installation instructions:

Pdf Export

  • This extension is being actively developed further and is compatible with MediaWiki versions up to 1.19.
  • It supports a multitude of converter backends (mPDF, MwLib, DOMPdf, Prince). However, non of the backends allows the use of a range of templates. Pdf Export’s templates are encoded tightly in the extension itself. And generally the wiki’s own CSS is used for this.
  • Another shortcoming, in terms of professional use, is that one cannot embed files using Pdf Export. Attached files (Excel, Word, PDF etc.) which are linked to on the wiki are not exported with Export.


  • This extension generates whole PDF books on the basis of categories. This means that you can export several different pages that share the same category. Exporting individual pages is, on the other hand, not possible. Except if you assign a category to just a single page.
  • The extension is kept very simple and so it also has no templates.
  • PdfBook uses HtmlDOC as its converter backend, which is not available on shared hosts.

PDF Writer

  • This extension is just a converter backend for the “Collection” extension and is not usable on its own. There is more on Collections coming up in the next chapter on Wikipedia.
  • MwLib is used as converter backend.


  • Mpdf is a very simple extension which adds an “action” onto the Wiki for exporting a PDF.
  • The extension has little functionality and no support for templates or files.
  • It uses the converter backend mPDF.

Another interesting extension is PdfHandler. This does not produce any PDFs but it does allow one to view PDFs which have been uploaded.

As you can see, the MediaWiki extensions for exporting into PDF we have named above are very useful and helpful, but are generally missing functions which would be useful for business purposes.

On top of this, you have the usual problem with free software projects: Like all MediaWiki extensions, they are provided by independent developers. Thus it is not guaranteed that the extensions is maintained. So it is not always clear if the extension works with the newest version of MediaWiki or if it will ever be updated. And some extensions are constantly in the beta stage of development. For small wiki projects this may not be a problem. However it is rather different when a company is relying on the function, for example for the organisation’s handbook.

What does Wikipedia use?

On Wikipedia and its sister projects Wikisource and Wikibooks, one can bring together arbitrary collections of articles to make a book. In order to do this, one chooses the link “Create a book” under the menu “Print/export” and then one can add wiki articles to the book individually.

In principle, one can also equip any other MediaWiki with the same mechanism as Wikipedia. For this, one needs the extension Collections amongst other things. This is responsible for collecting articles. Collections is a lovely solution which alongside PDF, can also export in the ODF and DocBook XML formats. For this, collections uses the PDF Writer, OpenDocument Export and XML Bridge extensions.

Collections also makes it possible to send contents to a Print on Demand service which then makes professionally printed books. The Mainz company PediaPress GmbH is currently operating this service. Additionally, there is a nice side-effect: The existence of PediaPress ensures that the extensions in and around Collections are regularly updated.

However, using the Wikipedia mechanism is not always ideal for organisations and businesses:

  • The possibilities for adapting the layout are limited.
  • As Collections uses components in Python, knowledge of this programming language is necessary.
  • Attached files are also not supported.

BlueSpice free – PDF export suitable for businesses

For these reasons, we have developed an alternative for the MediaWiki enterprise distribution BlueSpice. The basic idea is summarised by Robert Vogel thus:

Individual pages are exported, and these can be supplied with a template by people with a little technical knowledge, so that the user can print a PDF document with the design of the business or organisation. We employ widely used web standards which many developers are familiar with. This makes individual solutions possible. Instead of Python, we use Java. And BlueSpice’s template system is based on HTML. In this way, templates can be made which have ones own graphics (logos, banners), individual document structure (headers and footers, integration of metadata such as author, date or category) and designs (colours, fonts).

In general, everyone who extends their MediaWiki with the free and publicly available extension BlueSpice has access to this PDF export facility. The free version lets one export individual pages. In addition, the free version offers:

  • The template system based on web standards. This means that with the right technical knowledge, one can write ones own templates.
  • The ability to export special pages, category pages and image pages.
  • The possibility to hide text elements for passages which are not for all eyes.

You can download BlueSpice free and find installation instructions here.

BlueSpice [bookmaker] – A professional module for PDF books

BlueSpice-Paket [bookmaker] equips BlueSpice PDF Export with a book function, subject to a charge.

BlueSpice makes it possible to create books with titles and subtitles using a mask, and additionally to change existing books. The structure of the chapters can be created from scratch or adapted from an existing version, all via Drag & Drop.

To create a PDF book with [bookmaker], it is only necessary to choose the items wanted (if only parts from the book are needed) and click once on the button “Create PDF”. One gets a PDF book straight away.

The PDF is created with title page, contents, release notes and attached files.

If the CSS has been adapted for the firm, then the book gets wiki pages and a title page in the firms design, a clickable contents page, notes on attached files and release notes.

Let us mention two more special features:

  • Including file attachments: [bookmaker] pulls the linked documents (forms, Excel files, Power Point presentations…) into the document and lists them as appendices.
  • Exporting with differing templates: It is even possible to tag a page to use a special template for export.

Bookmaker 2013

BlueSpice [bookmaker] allows the integration of chapter navigation.

We are currently working on further improvements which will become available at the start of 2013:

  • Working with wide tables: Wide tables can be flagged. This means they will be turned on their side when exported. This function already exists in a beta version. However, we want to work with this a bit more.
  • Internal links: Up to now, you have been able to jump from the contents page to the page you want in the document. Internal links in the body of the document still point outside the PDF to the wiki pages. In the future, one will be able to jump to the right place in the document with the internal links.
  • Linking of attached files: Attached files which are linked in the body of the document will soon be able accessible using the links. Up to now, the links have pointed back out of the PDF to the source in the wiki.

The development team is always eager to hear further suggestions.

You Might Also Like

Leave a Reply