Install TCPDF on drupal

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();

	}
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值