aw schriftzug.png aw logo 60x60.png

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: https://wiki.alexander-weimer.com/bin/view/System/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

Author: Foswiki:Main/ArthurClemens
Copyright ©: Arthur Clemens
License: GPL
License: wkhtmltopdf: GNU Lesser GPL
Version: 14875 (2012-05-21)
Release: 1.1.0
Change History:  
21 May 2012 1.1.0 Adoption of 'best practice' from GenPDFWebkitPlugin, using completePageHandler.
19 May 2012 1.0.0 First release.
Dependencies:
NameVersionDescription
wkhtmltopdfRequired
File::Temp>0Required
Home: http://foswiki.org/Extensions/PdfPlugin
Support: http://foswiki.org/Support/PdfPlugin

Topic attachments
I Attachment Action Size Date Who Comment
apple_com.pdfpdf apple_com.pdf manage 787 K 2012-05-19 - 19:36 AdminUser PDF of Apple.com homepage
examplesites.pdfpdf examplesites.pdf manage 152 K 2012-05-19 - 19:10 AdminUser PDF version of http://foswiki.org/About/ExampleSites (dd.19 May 2012)
macros.pdfpdf macros.pdf manage 857 K 2012-05-19 - 19:36 AdminUser PDF of System.Macros
Topic revision: r1 - 2012-05-21, UnknownUser
This site is powered by FoswikiCopyright &© by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback