TIP PdfPlugin is not installed on Foswiki.org.

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://foswiki.org/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

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
PdfPlugin.md5md5 PdfPlugin.md5 manage 150 bytes 21 May 2012 - 20:29 ArthurClemens  
PdfPlugin.sha1sha1 PdfPlugin.sha1 manage 174 bytes 21 May 2012 - 20:29 ArthurClemens  
PdfPlugin.tgztgz PdfPlugin.tgz manage 846 K 21 May 2012 - 20:27 ArthurClemens  
PdfPlugin.zipzip PdfPlugin.zip manage 848 K 21 May 2012 - 20:26 ArthurClemens  
PdfPlugin_installerEXT PdfPlugin_installer manage 4 K 21 May 2012 - 20:28 ArthurClemens  
apple_com.pdfpdf apple_com.pdf manage 787 K 20 May 2012 - 00:09 ArthurClemens PDF of Apple.com homepage
examplesites.pdfpdf examplesites.pdf manage 152 K 19 May 2012 - 23:51 ArthurClemens PDF version of http://foswiki.org/About/ExampleSites (dd.19 May 2012)
macros.pdfpdf macros.pdf manage 857 K 20 May 2012 - 00:03 ArthurClemens PDF of System.Macros
Topic revision: r2 - 21 May 2012, ArthurClemens - This page was cached on 29 Jun 2016 - 15:59.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License