We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
You are here: TWiki> Plugins Web>PdfPlugin (17 Feb 2006, PeterThoeny)
Tags:
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:
Book-mode
large document with <h1> chapter headings; adds title page + table of contents page(s)
Article-mode
if no chapter headings are present, render just a small title header on the first page.

Syntax Rules

Authors

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.

Administrators

See installation section.

Examples

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

Administration

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

%ABSTRACT%:
The block of text up to the first headline of level 1
%REVUSER%:
The user who checked in the last revision
%AUTHORLIST%:
Alphabetical lists of all contributors to the plugin.
%REVDATE%:
The date ~
%REV%:
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 Action Size Date Who Comment
zipzip PdfPlugin.zip manage 6.8 K 01 Sep 2003 - 19:36 PeterKlausner As-is version for AthensRelease
Topic revision: r5 - 17 Feb 2006 - 00:15:14 - PeterThoeny
Plugins.PdfPlugin moved from Plugins.PdfPluginDev on 03 Sep 2003 - 10:23 by RichardDonkin - put it back
 
TWIKI.NET
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback