PDF Plugin
Generate high quality PDF files from topics.
Introduction
The PDF generator of PDF Plugin is
wkhtmltopdf, which uses the WebKit browser engine. It creates PDF files that look similar as they would look in browsers using the same engine (Apple Safari or Google Chrome). It has support for CSS3.
Some examples of generated PDFs:
Usage
View the PDF version of a topic by adding
contenttype=application/pdf
to the url like this:
%SCRIPTURL{"view"}/%WEB%/%TOPIC%?contenttype=application/pdf
Test this:
http://365847.689093.cn/Extensions/PdfPlugin?contenttype=application/pdf
Limitations
- Currently you can only create one page at a time.
- Additional format parameters are not supported.
Adding PDF buttons to the page
Add
pdf
to the skin path, for example:
* Set SKIN = pdf,pattern
or to put the 'pdf skin' in front of any skin:
* Set COVER = pdf
The button label is configurable. Re-define module
pdf:text
in your own skin, and put it in front of the skin path:
* Set SKIN = myskin,pdf,pattern
For more help see
SkinTemplates.
Installation instructions
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. Use "Find More Extensions" to get a list of available extensions. Select "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
http://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Installing wkhtmltopdf
This plugin depends on
wkhtmltopdf, a converter from html to pdf using webkit (qtwebkit).
wkhtmltopdf
is available on Linux, Windows and Mac OSX. See
Installing WKHTMLTOPDF for instructions for your platform.
Known issues
wkhtmltopdf
version
0.9.1
:
- anchors still don't work: acroread throws a security exception
wkhtmltopdf
version
0.8.3
:
- links don't work even local #anchors don't do it; they are only drawn viually; bug report
- the
<base href="... />
html header must occur before any other js or css files in the html source; relative urls before are not resolved correctly (this is a general webkit problem – not a wkhtmltopdf issue)
- there's no way to provide a base url on the command-line if a
<base ...>
tag is missing in the html source
- a couple of important css3 features are not implemented yet, e.g.
::after
, ::before
, leader()
, target-counter()
, @page
, string-set
, title
, chapter
, hyphens
Configuration settings
In Configure you can set these settings:
Setting |
Explanation |
Default value |
wkhtmltopdf |
Location of the wkhtmltopdf executable. |
/usr/local/bin/wkhtmltopdf |
pdfparams |
Parameters passed to wkhtmltopdf . |
-q --enable-plugins --outline --print-media-type |
Debug |
Writes debugging output to debug.log . |
0 |
Plugin Info