Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

GeneratePDF

Summary: Generate PDF versions of pages (?action=pdf)
Version: 2006-09-07
Prerequisites: PmWiki >=2.1.0, htmldoc >=1.8.27
Status: Stable
Maintainer: Pm
Categories: PDF
Discussion: GeneratePDF-Talk

Questions answered by this recipe

  • Can I generate a PDF file on the fly from a wiki page?

Description

The htmldoc package combined with the generatepdf.phpΔ script adds an ?action=pdf option that will generate PDF copies of a wiki page.

Notes

First, download and install htmldoc onto your system, and download and install the generatepdf.phpΔ script into your cookbook directory.

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 1cell 2cell 3
left-aligncenterright-align

See Also

Contributors

  • Jason Green -> mailto:jgreen_at_mykmg [period] net
  • Pm

Comments

See discussion at GeneratePDF-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on October 20, 2013, at 08:00 PM