Login / Status
developer.Resource
Home . Documentation . Document Library . Extension Manuals
Sponsors
hosted by punkt.deTYPO3 and Open Source Magazine

Chapter 1. EXT: PDF Generator 2

Extension Key: pdf_generator2

Copyright 2000-2002, Jens Ellerbrock, <je@hades.org>

This document is published under the Open Content License

available from http://www.opencontent.org/opl.shtml

The content of this document is related to TYPO3

- a GNU/GPL CMS/Framework available from www.typo3.com

1.1. Introduction

What does it do?

If the user wants to print a document document served by typo3 he is usually offered a HTML page that contains only the relevant content of the page while the images are served as separate files. This works fine for printing, but if the user wants to save the page for archiving or offline printing it would be nice to embed the images within only one document. Adobe Acrobat PDF offers a suitable file format for that purpose which is widely and os-independently supported.

This extension is based on the pdf_generator but uses a different html to pdf converter.

How does it work?

The extension generates a “printer-friendly” HTML-page internally. This page is passed through html2pdf to generate a PDF file. The PDF file is then served to the user while being cached by the usual caching mechanism of typo3.

The PDF page can be linked to from the Typoscript template using the stdWrap.postUserFunc parameter. Either dynamic Filenames (i.e. Index.php?id=12&type=123)  or static (<alias>.PDF of 12.pdf) filenames are supported.

What is html2pdf?

Html2pdf s a 100% php based script that converts html including css to pdf (and alternatively to postscript which is not supported here). Unlike the htmldoc based solution css is supported and no external binaries are required.

It uses either the fpdf or the pdflib library to perform the rendering. Both methods give slightly different result both regarding rendering speed and rendering results. If you want to use pdflib you'll have to install additional fonts.

Supported content

Theoretically the PDF_generator 2 extension supports all content that can be rendered in HTML with css (i.e. all). It is however restricted by the html2pdf script it is using.

TemplaVoila Support

The extension supports templavoila by using the extension tv_pdfgen. See this extensions manual for a description on how to use templavoila with the pdf_generator2.

File Based Caching

If you do not want to store large generated files in the database, you can use the additional extension file_based_cache which will cache large files in the filesystem instead.