You are here: Home Plone products PDFNode

PDFNode (0.3.0)

1
by Olha Pelishok last modified 2008-09-03
0.0
0.0
0.0
0.0
Released on 2008-09-01 by Pilot Systems for Plone 2.5, Plone 3.0, Plone 3.1 under GPL - GNU General Public License available for All platforms.
Software development stage: stable
PDFNode is Zope tool to help creating aggregated PDF files from HTML, LaTeX, PDF and other sources.

Usage

PDFNode is a Zope (or Python) product to generate PDF files from different inputs: HTML, PDF or LaTeX. It doesn't handle PDF generation itself (htmldoc or pdflatex do it), but it handles the multiplexing of those formats into on final file.

The typical use is to create a PDFDocument object, to configure it, to add data (which can be divided into sections) to it, and then to generate the final document.

Prerequisite

PDFNode requires:

  • Zope 2.7 or higher (Python 2.3 or higher)
  • pdflatex
  • htmldoc for the text/html support

The PDFDocument class can also be used outside of Zope, with Python 2.3 or higher.

If BlueDCS is installed, PDFNode will be able to use it to convert Office documents to PDF.

API overview

The main tool (PDFNode) provides three methods:

newPDF

This create a new, preconfigured, PDFDocument object.

This object can be then filled with content.

generate
Generate a PDF file from a PDFDocument object and the name of the file. It'll set HTTP headers so the download will be started as desired.
renderAsPdf
This is a helper method calling the two previous ones to convert a HTML string (with optional PDF attachments) into a PDF file.

The PDFDocument class provides several methods:

configure/reconfigure
Those two methods can be used to dynamically change properties, like TOC generation, name of commands to use, ...
set_title
Sets the global document title (and author name).
add_data

This the main method, adding data to the PDF file. The data and mimetype must be provided, and additional informations like section and title (for TOC generation) can be provided.

Out of the box, PDF, LaTeX, HTML and plain text are supported.

add_*
Those methods are helper to the previous one.
add_list, add_description
Add a bullet list, or a key/value list, using LaTeX code.

Extending

PDFNode can be easily extended to support additionall renders. You can have a look in the PDFRenderers/ directory for more informations. Registering a new render, for now, has to be done by doing

from Products.PDFNode.PDFRenderers import renderers
renderers[my_mimetype] = MyRenderClass

Future versions

Usage of pisa instead of htmldoc to convert HTML to PDF is planned in a future version.

Document Actions
Powered by Plone