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

Chapter 1. EXT: PDF Generator

Extension Key: pdf_generator

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.

How does it work?

The extension generates a “printer-friendly” HTML-page. This page is passed through HTMLDOC 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 HTMLDOC?

HTMLDOC is an open-source software by Easy Software Products. Among other things it has the ability to render HTML-pages as PDF files. HTMLDOC supports standard HTML though css is not supported yet. HTMLDOC is available for Windows and Linux/Unix compatible systems.

Supported content

Theoretically the PDF_generator extension supports all content that can be rendered in HTML (i.e. All). However, since the conversion from HTML to PDF is done using HTMLDOC, not everything will automatically look fine in PDF.

Supported HTML Level

HTMLDOC currently supports most HTML 3.2 and some HTML 4.0 elements. HTMLDOC does not support HTML 4.0 tables, attributes, stylesheets, or scripting. HTML 4.0 functionality will be provided in HTMLDOC 1.9 which is currently developed. Please note that there is no estimated time of release.

Supported fonts

HTMLDOC is able to generate the following type1 fonts within the generated PDF files. HTMLDOC does not currently allow embedding of arbitrary fonts specified by the HTML FONT element.

  1. Courier

  2. Helvetica

  3. Symbol

  4. Times

Each embedded font adds approximately 43k of data to PDF files. The full set of Type 1 fonts adds 555k to PDF files.

Links to webpages and mail-addresses

addresses

Links to other pages and email-addresses in the HTML files will be kept in the PDF files as well.

Prerequisites

This extension calls another programm via popen() or exec() (configurable). This will not work if your server is running in safe mode.

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_generator.

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.

Demo

A working demo can be found at http://test.drachenorden.de.