html2ps/pdf requirements

Back to table of contents

Required:

  1. PHP 4.1.0 or newer (PHP 5 is supported)
  2. native PHP DOM XML OR Active-Link DOM XML extension installed
  3. GD PHP Image Extension, version 2.0.28 or newer. Note that you may use GD starting with version 2.0.1, but you will lack GIF support.

If your system satisfies this requirements, you will be able to generate uncompressed Postscript files. Use GhostView or any other Postscript viewer to view/print these files. Note that Acrobat Reader cannot read Poscript files!

Also, use native DOM XML PHP extension if possible.

Highly recommended:

  1. Zlib PHP extension -- allows compressed Postscript file generation. Compression greatly reduces the generated file size, up to 5-7 times, saving significant bandwidth.
  2. Ghostscript version 7.05 or newer -- allows generation of PDF files (strictly speaking, script generates Postscript file, then converts it to PDF using Ghostscript). Please note that you'll need to have the ghostscript fonts package intalled in order for this conversion to work!. Also, keep in mind that Ghostscript is an external program, so you'll need to have the exec function enabled in your PHP configuration; if you're using PHP in safe mode, it is probably disabled. It might be disabled even if safe mode is not in use. Please check with your system administrator regarding the availability of the exec function.
  3. PDFLIB -- allows direct PDF generation; in general, PDF files generated via PDFLIB have better image quality and renders a little bit faster than PDFs created using Ghostscript. Nevertheless, PDFLIB is a non-free library, so you'll probably will need to buy a license for it.

If your system satisfies this requirements, you will be able to generated both Postscript and PDF files.

Note: You can choose either Ghostscript or PDFLIB (or both). Only one of these packages is needed for PDF generation. Another option is to use the FPdf libraries, which are bundled with html2ps/pdf. Using this method to generate PDFs is slower, but does not require external libraries.

Recommended:

  1. iconv PHP extension -- allows faster and more stable HTML page conversion from different charsets (you can ignore this requirement if the pages you're working with do not contain non-iso-8859-1 symbols -- central european or cyrillic, for example)

Systems satisfying these recommended requirements will have a minor boost in conversion speed.

Recommended PHP configuration settings:

  1. PHP Memory limit should be set to 32-62 megabytes;
  2. PHP Script time execution limit should be set to 2-3 minutes;

Systems NOT satisfying these requirements MAY be not able to process complicated pages with big images. The exact values of these variables should be determined experimentally (trial and error).

Client-side software:

  1. Ghostscript version 7.05 or newer and GSView -- to view generated compressed and uncompressed files and to convert them to PDF on the client side.
  2. Adobe Acrobat Distiller -- to convert Postscript files to PDF on the client size (Ghostscript alternative).
  3. Adobe Acrobat Reader -- to view PDF files.