publish1Add my vote for this tag create new tag
, view all tags

PDF Plugin

WARNING: I mentioned it a few times, and a few people asked for it, but I never really finished it. As a start, check the attached zip, which works against a patched TWiki:Codev/AthensRelease

For a more advanced implementation of the TWiki:Codev.PrintUsingPDF functionality take a look at GenPDFAddOn

Preliminary Documentation

The PdfPlugin converts TWiki pages into PDF format on the fly. Basically, it just pipes any rendered page into the tool HTMLDOC from http://www.easysw.com/htmldoc/

Typical Use Cases

  • Huge printouts, which need table of contents with real page numbers
  • Nice printouts with running headers, logos, properly scaled images
  • Nice presentations with controlled page breaks, automatic sequence etc.
  • Online Manuals in one file with hierarchic navigation

How to write

Technically, the Plugin distinguishes two modes:
large document with <h1> chapter headings; adds title page + table of contents page(s)
if no chapter headings are present, render just a small title header on the first page.

Syntax Rules


Users have to care only, if they need hand-made presentation markup. Then use the HTML comments understood by the HTMLDOC tool -- see section 4 'tbd' of the manual.


See installation section.


You have a simple page without <h1> headline: the plugin creates a simple PDF. Then:

  • The page title (its WikiWord) is inserted as =<h1> headline at the beginning of the text.

You have a large document -- typically with a lot of includes -- and supplied a =<h1> headline. Then:

  • The text section leading up to that first headline is taken as abstract.
  • An extra title page template is loaded, e.g. pdftitle.tmpl.
  • The abstract and the aforementioned fields are filled in. (The native %REVINFO% doesn't cut it for a nice printout.)
  • A table of contents begins on the next sheet.
  • The text body begins on the next sheet.

PdfPlugin Global Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Use HTMLDOC to postprocess your page into PDF
  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0
  • My own setting: Check the templates directory


Administrators have a few extra variables to build title page templates:

The block of text up to the first headline of level 1
The user who checked in the last revision
Alphabetical lists of all contributors to the plugin.
The date ~
The revision number -- just the plain number w/o leading r1.

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip PdfPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/PdfPlugin.txt Plugin topic
    lib/TWiki/Plugins/PdfPlugin.pm Plugin Perl module
    bin/view.pdf.patch Necessary patch for TWiki:Codev/AthensRelease view
    templates/view.pdf.tmpl skin=pdf to render page body as pdf
    templates/pdfcall.tmpl commandline for external call to HTMLDOC
    templates/pdftitle.tmpl separate titlepage template for any skin, if in book mode
  • Patch bin/view to use this plugin
  • Test if the installation was successful:
    • enter samples here

Plugin Info

Plugin Author: TWiki:Main/PeterKlausner
Plugin Version: 24 Sep 2002 (V1.000)
Change History:  
24 Oct 2002: Working version
1 Sep 2003: publis as-is
CPAN Dependencies: none
Other Dependencies: HTMLDOC from http://www.easysw.com/htmldoc/
Perl Version: 5.005
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/PdfPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/PdfPluginDev

Related Topics:

-- TWiki:Main/PeterKlausner - 24 Oct 2002

Topic attachments
I Attachment History Action Size Date Who Comment
Compressed Zip archivezip PdfPlugin.zip r1 manage 6.8 K 2003-09-01 - 19:36 PeterKlausner As-is version for AthensRelease
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2006-02-17 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.