Extension:Pdf Export

Overview
Here is a simple special page you can add to do PDF export. It works with the open source htmldoc package. From a UI standpoint it plugs in just like SpecialCite.php, and appears as a link in the toolbox. When you click the link, the current page is rendered minus all the navigation stuff and written to a temp file. The temp file is passed through Htmldoc which sends the PDF back to the browser.

The current version works with recent versions of MediaWiki, with a few tweaks it works with 1.6.7 and newer as well. On Windows: If you're having trouble with the images rendering, you may have to fiddle with how the pathnames get generated for them. In general the easy way to debug this extension is to comment out the line that removes the temp file. That way you can both check and hand-code the temp file, as well as manually run it through htmldoc to see what happens. Try commenting out $bhtml = str_replace ('/w/',$wgServer . '/w/', $bhtml);
 * you'll need to make sure the paths are right(put htmldoc in Path environment variable)
 * you have to properly construct the tmp directory (script will test existence of C:\Windows\Temp or C:\Winnt\Temp)
 * Replace in PdfExport.php file (see below) the ' by ", to do so, just uncomment the windows line

Installation
The only prerequisite is installing Htmldoc (on Debian based systems such as Ubuntu or Mepis use: apt-get install htmldoc). Windows Binary can be found here (v1.8.24) and here (v1.8.27).

Then save the source files as described below, add the following to your LocalSettings.php:

Source Code
Put the following into $IP/extensions/PdfExport/PdfExport.php:

Internationalization
Then put the following into $IP/extensions/PdfExport/PdfExport.i18n.php: