使用tcpdf软件 在线预览pdf文件

<?php

require_once('/var/www/html/htdocs/tcpdf/config/lang/eng.php'); //包含两个文件就加载tcpdf库
require_once('/var/www/html/htdocs/tcpdf/tcpdf.php');

require_once('/var/www/html/htdocs/database.php');

$thbgcolor ="bgcolor=\"#C9D6A6\""; //定义变量
$tdbgcolor0="bgcolor=\"#DFE3E6\"";
$tdbgcolor1="bgcolor=\"#EDF1F4\"";
$tdbgcolor2="bgcolor=\"#66CCFF\"";
$tdbgcolor3="bgcolor=\"#B0C4DE\"";
$tdbgcolor4="bgcolor=\"#FFE4C4\"";

define("MSSP_TABDEF", " border=\"1\" cellpadding=\"1\" cellspacing=\"1\""); //定义常量
define("MSSP_TABDEF2", " border=\"1\" cellpadding=\"1\" cellspacing=\"1\" width=\"%50\"");
define("MSSP_TDWIDTH", " width=\"76\" ");
define("MSSP_TDWIDTH2", " width=\"65\" ");
define("MSSP_TDWIDTH3", " width=\"68\" ");
define("MSSP_TDWIDTH4", " width=\"76\" ");
define("MSSP_TDWIDTH5", " width=\"78\" ");

$Product_info_total = 0;

$Contract_ID = $_REQUEST['Contract_ID']; //接收数据

$pdf_filename=$Contract_ID;

header("Content-Disposition: attachment; filename=$pdf_filename.pdf");

$sql = "select c.no Contract_No, c.Date Contract_Date, e.Name Employee_Name  from tbl_contract c, tbl_employee e where c.id=65 and e.id=Employee_ID";
//从数据库查出合同为65的合同名称 合同日期和销售


display_content_pdf($Contract_ID,$msspdb,$pdf_filename); //header("/htdocs/download/" . $pdf_filename);


function display_content_pdf($Contract_ID,$msspdb,$pdf_filename)
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, '30', '','*****有限公司'); //头内容 想查找常量,需到/tcpdf/config/tcpdf_config.php中查找
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_F
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值