Extension:Collection/PDF Writer

Overview
mwlib.rl is a python library for writing pdf documents from mediawiki articles which were parsed by the mwlib library.

See this press release Wikis Go Printable for more information on this project.

Technical
The PDF Writer uses the Python Reportlab libraries to generate PDF based on a DOM derived from parsing mediwawiki-markup using the mwlib parser. The Collection Extension can be used to select and manage articles that shall constitute the resulting PDF.

The PDF Writer can run standalone on a server and provide PDF generation for multiple MediaWiki instances. A server for public testing runs at http://tools.pediapress.com.

Source
mwlib.rl is copyrighted by PediaPress and is distributed under a BSD license (see the included README.txt for details).

Current sources can be obtained from our mercurial repository found at http://code.pediapress.com/hg/mwlib.rl. You can checkout a copy with the following command line (after installing mercurial):

hg clone http://code.pediapress.com/hg/mwlib.rl mwlib.rl.hg

If you don't have mercurial installed, you can use the following link to download the current version: http://code.pediapress.com/hg/mwlib.rl/archive/tip.tar.gz

Note that you will at least have to use python 2.4 and some kind of unix-like operating system (at least that is what we are using to develop mwlib.rl).

Install it with either 'python setup.py build install' or 'python setup.py develop'.

You will also have to install mwlib and reportlab. Currently you have to use the svn-version of reportlab which can be installed with the following command (after installing subversion)

svn co http://www.reportlab.co.uk/svn/public/reportlab/trunk

Mailing List
We've setup a gougle group for discussion of mwlib.rl. You can subscribe per email: mailto:mwlib-subscribe@googlegroups.com.

Programs
mwlib installs the following programs:


 * mw-pdf
 * generates a pdf from a mediawiki article


 * mw-pdfcollection
 * generates a pdf from a mediawiki collection (collections can only be made with mediawiki installations that have the Collection extension installed)


 * mw-zip2pdf
 * generates a pdf from a zip file generated by mwlib

All of those programs take a -c/--config argument. The config file describes the virtual wiki to use.

Configuration
Example config file using mwapidb to download needed files via MediaWiki API from the English Wikipedia:

[images] type = mwapi base_url = http://en.wikipedia.org/w/

[wiki] type = mwapi bas_eurl = http://en.wikipedia.org/w/ license = Wikipedia:GFDL

Example config file using netdb to download needed files from the English Wikipedia: [images] type = download url = http://upload.wikimedia.org/wikipedia/commons/ localpath = ~/en-images

[wiki] type = net url = http://en.wikipedia.org/wiki/@TITLE@?action=raw

Example config file using cdbwiki (as created by the tool): [wiki] type = cdb path = /home/ralf/enwiki

[images] type = download url = http://upload.wikimedia.org/wikipedia/commons/ localpath = ~/enwiki/images

Example
[[Media:Solar system final.pdf|Solar system, example article from the English language Wikipedia, rendered as PDF using the PediaPress technology.]]

Other Approaches

 * Extension:Pdf Book
 * Extension:Pdf Export