Questions answered by this recipe
- Can I generate a PDF file on the fly from a wiki page?
Next, tell the GeneratePDF script where to find the htmldoc executable on your system:
$HtmlToPdfCmd = '/path/to/htmldoc -t pdf --quiet --webpage'; include_once('cookbook/generatepdf.php');
NOTE: In Windows you'll want to download the HTMLDoc binaries, and perform an install. If you get the binaries from EasySW you'll need to purchase a license. Alternately do a Google search and find a free source for the binaries, or compile your own from the source. Your path line will then look something like this (note the double quotes since we have a space in the path):
$HtmlToPdfCmd = '"C:\Program Files\HTMLDOC\htmldoc.exe" -t pdf --quiet --webpage';
That's it! Using ?action=pdf on your pages should result in PDF versions of the file. For example, you can try it on this page with Cookbook.GeneratePDF?action=pdf.
By default, GeneratePDF uses PmWiki's 'print' skin to format the page; this can be changed by setting
$ActionSkin['pdf'] = 'myskin';
Test with an image
Test with a table
|cell 1||cell 2||cell 3|
- PmWiki2PDF - Uses FPDF and HTML2FPDF to generate on the fly PDF's.
- Affinity's Wikipublisher project - Much more complex and elegant solution as opposed to this quick and easy hack. This is coming to fruition as PublishPDF
- Jason Green -> mailto:jgreen_at_mykmg [period] net
See discussion at GeneratePDF-Talk