欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

输出PDF的有关问题

程序员文章站 2022-06-11 15:17:24
...
输出PDF的问题
本帖最后由 zhuhao 于 2012-12-31 19:54:16 编辑

$id=$_GET['number'];

$uploaddir = 'download/';
$Date = date("YmdHis");
$filenamepdf = $uploaddir."Label_print".$Date.".pdf";



require_once('tcpdf/config/lang/eng.php');
require_once('tcpdf/tcpdf.php');
include("conn.php");

$pdf = new TCPDF('L', 'mm', 'BUSINESS_CARD_JP', true, 'UTF-8', false);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetFont('arialunicid0', '', 10);
$pdf->SetMargins(1,1,2,false);
$pdf->setFooterMargin(1);
$pdf->SetAutoPageBreak( true, 1 );


$Sql_hkpdf = "SELECT * , group_concat(' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , if(`quantity-purchased`> 1, '****' , ' ') ),group_concat(' ' , `order_id` , ' ') FROM ( select * from `sale_orders` order by `sku`) T WHERE `shipments` =0 AND `number` =$id GROUP BY `recipient-name` , `ship-address-1` ORDER BY length(group_concat( ' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , ' ' )) DESC,`sku`";


$Result = mysql_query($Sql_hkpdf);


while($rs = mysql_fetch_array($Result) ){

$ship_address=$rs['ship-address-1'].$rs['ship-address-2'].$rs['ship-address-3'];
$sku=$rs["group_concat(' ' , concat_ws( ' X ', `sku` , `quantity-purchased` ) , if(`quantity-purchased`> 1, '****' , ' ') )"];
$ship_postal_code="〒".$rs['ship-postal-code'];

$ship_city="日本 ".$rs['ship-state']." ".$rs['ship-city'];
$recipient_name=$rs['recipient-name']." 樣";
$buyer_phone_number="電話番號:".$rs['buyer-phone-number'];
//$hkdizhi='From : Unit A1 , 7/F,Cheung Kong Factory Bldg , 6 Cheung Yee Street , Lai Chi Kok , *';
$pdf->AddPage();
$pdf->SetFont('arialunicid0', '', 8);
$pdf->Write(0, $sku, '', 0, 'R', true, 0, false, false, 0);
$yy=$pdf->GetY();
$xx=$pdf->GetX();
$style = array('width' => 0.2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0));
$pdf->Line(2, $yy+0.3, 89, $yy+0.3, $style);
$pdf->SetFont('arialunicid0', '', 10);
$pdf->Write(0, $ship_postal_code, '', 0, 'L', true, 0, false, false, 0);
$pdf->Write(0, "\n", '', 0, 'L', true, 0, false, false, 0);
$pdf->Write(0, $ship_city, '', 0, 'L', true, 0, false, false, 0);
$pdf->Write(0, $ship_address, '', 0, 'L', true, 0, false, false, 0);
$pdf->Write(0, "\n", '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('arialunicid0', '', 12);
$pdf->Write(0, $recipient_name, '', 0, 'C', true, 0, false, false, 0);
$pdf->SetFont('arialunicid0', '', 10);
$pdf->Write(0, $buyer_phone_number, '', 0, 'C', true, 0, false, false, 0);
输出PDF的有关问题

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频


网友评论

文明上网理性发言,请遵守 新闻评论服务协议

我要评论
  • 输出PDF的有关问题
  • 专题推荐