DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:pdfexport

This is an old revision of the document!


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:

html2ps PHP Script

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

  • Install html2ps. (To run the php script you'll need ghostscript or libpdf - install them first!)
  • Add the Export to PDF button as described above.
  • In the function act_export, in inc/actions.php, add this:
      if ($act == 'export_pdf')
      {
     header("Location: " . DOKU_BASE.'html2ps/html2ps.php?URL='.urlencode(wl($ID, '', true)).'&pixels=1024&media=A4&ps2pdf=2&output=0&cssmedia=screen&renderimages=1&scalepoints=1&leftmargin=10&rightmargin=10&topmargin=10&bottommargin=10');
        exit;
      } 

Variations

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

  • urlencode(wl($ID, '', true))

    urlencode(wl($ID, '', true).'&do=export_html')

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.




*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.

tips/pdfexport.1430036713.txt.gz · Last modified: 2015-04-26 10:25 by 81.65.61.129

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki