wiki index
developer documentation
- Code documentation
- API documentation
- Module development
- Plugin development
- Using webber's properties
- Coding guidelines
user documentation
Installation
Upload the module folder to 'various/modules' using your ftp client. Once uploaded go to 'Manage » Settings » Modules' and activate it from the table presented.
Requirements
HTML2PDF has very few requirements, however, there are certain php extensions that would make a difference in quality, speed etc.
Must have's:
- PHP 4.1.0 or newer (PHP 5 is supported)
- native PHP DOM XML OR Active-Link DOM XML extension installed
- gd - GD PHP Image Extension, version 2.0.28 or newer
- PHP must run with safe_mode Off
Recommended:
- Zlib PHP extension – allows compressed Postscript file generation.
- Ghostscript version 7.05 or newer – allows generation of PDF files
- PDFLIB – allows direct PDF generation
- iconv PHP extension – allows faster and more stable HTML page conversion from different charsets
- tidy PHP extension (without tidy many of the websites will give errors due to bad code)
Recommended PHP configuration settings:
- at least 128M of RAM available
Advanced usage
How to generate TOC (table of contents)
If you wish to generate a TOC for your PDF file you will have to follow certain guides. HTML2PDF module uses the html2ps library. You may find some more advanced instructions there. Here's a page to learn about generating table of contents: http://www.tufat.com/docs/html2ps/generated_toc.html
API Documentation
To use the API and generate PDF's with it you must include the API file in your code:
To PDF from url's
<?php include_once '/path/to/html2pdf/HTML2PDF_api.php'; $api = new HTML2PDF_api (); $api->title = 'my pdf title'; $api->is_url = TRUE; $api->user_id = 1;//if this is not set, the api will try to get the id of the logged in user $api->urls = array ( 'http://www.google.com', 'http://www.msn.com' ); $api->content = '';//leave it empty since the content will be fetched from the urls //let's store the newly inserted PDF id in a variable $newPDF_id = $api->save (); if ( $newPDF_id ) {//if the PDF file was stored we can play with the ID or...whatever //do something... }
To PDF from given content
<?php include_once '/path/to/html2pdf/HTML2PDF_api.php'; $api = new HTML2PDF_api (); $api->title = 'my pdf title'; $api->is_url = FALSE; $api->user_id = 1;//if this is not set, the api will try to get the id of the logged in user $api->content = '<b>Some title</b><hr /><p>Some content</p>'; //let's store the newly inserted PDF id in a variable $newPDF_id = $api->save (); if ( $newPDF_id ) {//if the PDF file was stored we can play with the ID or...whatever //do something... }
Need to add something?
That's right! Our documentation is built using a wiki where you can contribute or even suggest changes. If you want to participate and share your knowledge please register and start writing your content. An administrator will review your input and accept/decline it. In time, you can also become a member with full rights and all of your changes will be active automatically.
