Table of Contents

Export DokuWiki Pages to PDFs

Several methods exist to convert your wiki pages to PDFs. See also the full list of plugins tagged 'PDF'.

Plugins that export directly to PDF:

Other ways to generate PDFs:

Common changes

In order to export your pages to PDF you'll need to add a button to your wiki. Regardless which PDF converter you use, you need to implement the following changes:

Search for this line

$ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" ';

and replace with this.

//This allows the insertion of an icon in the menu bar
if ($name=="exportpdf"){
$ret .= '<input type="image" src="../lib/images/fileicons/pdf.png" value="'.htmlspecialchars($label).'" ';
}else{
  $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" ';
}

In order to have an export-link below the “Back to top”-link do the following:

Issues & Questions

Q: Where I will find required file /lib/plugins/pdf/renderer.php (and rest of files from /lib/plugins/pdf/) ?

A: If you follow the guide htmldoc then it wont complain about these missing files, as the system will not try to start a “pdf” plugin

html2ps PHP Script

Using the html2ps PHP script requires only little changes and additions to the DokuWiki source code.

Variations

If you want to remove the wiki structures and send the raw html page to the pdf exporter, edit the above so that

You may also wish to vary other options for the html2ps command, these can be found in the documentation on the html2ps site. I add renderlinks=1 and method=fastps (for building using ghostscript) to mine.

html2ps discussion

If your Wiki uses HTTPS, then get the patch for html2ps.

Issues

This appears to only work with pages that allow anonymous read access.

GIF images are not embedded into the generated PDF, instead only the first frame is shown.




*Is-someone knows where I can found the html2ps.php file ?. It's not provided with the package. Thanks. The file is in the Demo directory. Use the index file and the single URL convert to test your website before. My Website is Strict XHTML but looks horrible in PDF. Best regards from Germany.