php generate pdf

ExpandedBlockStart.gif 代码
<? php
require_once ( dirname ( __FILE__ ) . " /lib/fpdf/fpdf.php " );
require_once ( dirname ( __FILE__ ) . " /lib/fpdi/fpdi.php " );
$filename   =   " file/template.pdf " ;
$pdf = new  FPDI( ' P ' , ' mm ' , ' Legal ' );

// page one
$pdf -> AddPage();
$pdf -> setSourceFile( $filename );
$tplIdx   =   $pdf -> importPage( 1 );
$pdf -> useTemplate( $tplIdx );
// default autonumber
$pdf -> SetFont( ' Arial ' , ' B ' , 12 );
$pdf -> Cell( 135 );
$pdf -> Cell( 50 , 12 , ' sss ' , 0 , 0 , ' L ' );
// A1
$pdf -> Ln( 26 );
$pdf -> SetFont( ' Arial ' , ' B ' , 10 );
$pdf -> Cell( 47 );
$pdf -> Cell( 50 , 12 , ' xxxx ' , 0 , 0 , ' L ' );
// A2,A3,A4,A5
$pdf -> Ln( 4 );
$pdf -> SetFont( ' Arial ' , ' B ' , 10 );
$pdf -> Cell( 47 );
$pdf -> Cell( 50 , 12 , ' xxxx ' , 0 , 0 , ' L ' );
// B1
$pdf -> Ln( 16 );
$pdf -> SetFont( ' Arial ' , ' B ' , 10 );
$pdf -> Cell( 47 );
$pdf -> Cell( 50 , 12 , ' xxxxx ' , 0 , 0 , ' L ' );
// B2,B3,B4,B5
$pdf -> Ln( 7 );
$pdf -> SetFont( ' Arial ' , ' B ' , 10 );
$pdf -> Cell( 47 );
$pdf -> Cell( 50 , 12 , ' xxxxxx ' , 0 , 0 , ' L ' );
// B6
$pdf -> Ln( 5 );
$pdf -> SetFont( ' Arial ' , ' B ' , 10 );
$pdf -> Cell( 47 );
$pdf -> Cell( 50 , 12 , ' xxxxx ' , 0 , 0 , ' L ' );


// page two
$pdf -> AddPage();
$pdf -> setSourceFile( $filename );
$tplIdx   =   $pdf -> importPage( 2 );
$pdf -> useTemplate( $tplIdx );
// default autonumber
$pdf -> SetFont( ' Arial ' , ' B ' , 9 );
$pdf -> Cell( 152 );
$pdf -> Cell( 50 , 9 , ' xxxx ' , 0 , 0 , ' L ' );

header ( " Content-Transfer-Encoding " ,   " binary " );
header ( ' Cache-Control: maxage=3600 ' );  // Adjust maxage appropriately
header ( ' Pragma: public ' );
$pdf -> Output();
// $pdf->Output('document.pdf', 'D');
?>


转载于:https://www.cnblogs.com/aspxphpjsprb/archive/2010/04/28/1722920.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值