Install TCPDF on drupal:
1、download TCPDF from http://sourceforge.net,know more about TCPDF from http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf 2、unzip tcpdf and place it in drupal everywhere as you wish 3、configure tcpdf path: (1) open tcpdf->config->tcpdf_config.php (2) rewrite "K_PATH_MAIN" and "K_PATH_URL" path to make sure tcpdf knows where to place itself,eg:
/**
* installation path (/var/www/tcpdf/)
*/
define ("K_PATH_MAIN", "E:/apache_htdocs/liposuction.com/themes/garland/tcpdf/");
/**
* url path (http://localhost/tcpdf/)
*/
define ("K_PATH_URL", "http://localhost/liposuction.com/themes/garland/tcpdf/");
4、if you want to use tcpdf to create pdf file,just include tcpdf in your php page,in drupal thatcan be done like this:
// palce tcpdf in base path of drupal
if (!class_exists('TCPDF')) {
require_once drupal_get_path('',''). 'tcpdf/tcpdf.php';
}
or
// place tcpdf in theme which is used
if (!class_exists('TCPDF')) {
include_once path_to_theme(). '/tcpdf/tcpdf.php';
}
or
// place tcpdf in modules
if (!class_exists('TCPDF')) {
$path = drupal_get_path('module','tcpdf');
require_once($path . '/tcpdf.php');
}
5、then you can use tcpdf as you wish,the beginning usually like this:
class shippingPDF extends TCPDF{
public function Header() {
}
public function Footer() {
}
}
function createPDF(){
$pdf = new shippingPDF('P', 'mm', 'A4', true);
$pdf->Open();
...............
$pdf->Output(file_directory_temp().'/shipping.pdf', 'F');
$pdf->Close();
}