Several users proposed a way how to convert your HTML wiki pages to PDFs. Therefore you'll find 3 different solutions to the same problem on this page and another one on pdfdownload. The page exporting_pdf may be of interest, too.
You can also see this page htmldoc
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:
lib/tpl/main.php like so: <div class="bar" id="bar_top">
<div class="bar-left" id="bar_topleft">
<?php tpl_button('edit')?>
<?php tpl_button('history')?>
<?php print html_btn('exportpdf',$ID,'',array('do' => 'export_pdf')) ?> <!-- inserted line -->
</div>
(If you want the button to appear in the bottom bar use id=“bar_bottom”)
inc/lang/en/lang.php (or whatever language you use):$lang['btn_exportpdf'] = 'Export to PDF';
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" '; }
Q: Where I will find required file /lib/plugins/pdf/renderer.php (and rest of files from /lib/plugins/pdf/) ?
A: ???
Using the html2ps PHP script requires only little changes and additions to the DokuWiki source code.
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; }
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.
If your Wiki uses https, then get the patch for html2ps.
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.