Forgot Password? | Help

  • Home
  • Resources
    • Blog
    • News
    • Professional services
  • Projects
    • Webber
    • WB Ticket System
    • WB Blog
  • Contact
  • Support
    • Wiki
    • Forum
    • Ticket system

html2pdf

drSoft wiki

 
Trace: » discounts » module_development » syncronize » html2pdf

wiki index

  • Requirements
  • Installation instructions
  • Troubleshooting
  • Documentation
  • FAQ's

developer documentation

  • Code documentation
  • API documentation
  • Module development
  • Plugin development
  • Using webber's properties
  • Coding guidelines

user documentation

  • Manage Users
    • Quick add user
    • Banning
    • User logs
    • Invitations
    • Mass email
  • Manage Products
    • Orders
    • Discounts
    • Coupons
  • Manage Site settings
    • Cache
    • Modules
    • Backup
  • Manage User groups
    • Forms
    • Protected areas
    • Resources
  • Manage Language
    • Add to language
    • Add new language
    • Syncronize
Table of Contents
    • Installation
    • Requirements
      • Must have's:
      • Recommended:
      • Recommended PHP configuration settings:
    • Advanced usage
      • How to generate TOC (table of contents)
      • API 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...
}
 
 
html2pdf.txt · Last modified: 2009/09/22 16:34 (external edit)
 

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.

Home Resources Projects Contact Support Seo Web Design
© 2008 drSoft Ltd. All rights reserved.