Log inRegister
You are here: System » GenPDFWebkitPlugin

GenPDFWebkitPlugin

Generate PDF using Webkit

This plugin generates PDF using the Webkit rendering engine.

Usage

Get a PDF by adding contenttype=application/pdf to the view url like this:
%SCRIPTURL{"view"}/%WEB%/%TOPIC%?contenttype=application/pdf

Here's the complete Foswiki documentation in PDF.

Installation

Download wkhtmltopdf from http://wkhtmltopdf.org matching your platform. In configure make sure commandline template points to the proper location of the wkhtmltopdf binary.

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab → "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button. Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will not show up in the search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Known issues

as of wkhtmltopdf-0.12.3

  • local anchors as used in a tables of content still don't work (bug report)
  • there's no way to provide a base url on the command-line if a <base ...> tag is missing in the html source

Change History

12 Nov 2019 don't append the html page to the end of the pdf output
11 Jul 2016 added option pdfdisposition to inline or redirect content
16 Dec 2014 work around call to unofficial internal api to get absolute pub urls
12 Dec 2013 align with changes in Foswiki:Extensions/GenPDFPrincePlugin
12 Feb 2010 upgraded to wkhtml-0.9.1
17 Nov 2009 fixed use of uninitialized value
09 Sep 2009 initial release