TCPDF
下載: https://github.com/tecnickcom/TCPDF/archive/master.zip
安裝:解壓縮後直接上傳到網站的目錄上
測試:解壓縮的目錄內有examples子目錄,內有範例,直接執行範例,正常則出現pdf檔
使用:
只要先引入
require_once('class/tcpdf/config/tcpdf_config.php');
require_once('class/tcpdf/tcpdf.php');
就可以使用了,如要中文可設定
$pdf->SetFont('msungstdlight', '', 14, '', true);
常用的顯示方式
$pdf->AddPage();
// set text shadow effect
$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
$pdf->Cell('', '', '報 名 表', 0, 1, 'C', 0, '', false, '', '', '');
$y = $pdf->getY();
$pdf->writeHTMLCell(90, '', 10, $y, $html, 0, 1, 0, true, '', true);
$pdf->writeHTMLCell(90, '', 110, $y, $html, 0, 1, 0, true, '', true);
$pdf->MultiCell(15, 5, $work_id, 1, 'C', 1, 0, 20, 25, true);
$pdf->MultiCell(15, 5, $work_id, 1, 'C', 1, 0, 180, 25, true);
$style = array(
'position' => '',
'align' => 'C',
'stretch' => false,
'fitwidth' => true,
'cellfitalign' => '',
'border' => true,
'hpadding' => 'auto',
'vpadding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false, //array(255,255,255),
'text' => true,
'font' => 'helvetica',
'fontsize' => 8,
'stretchtext' => 4
);
$pdf->write1DBarcode($work_id, 'C39', 30, 200, 40, 18, 0.4, $style, 'N');
$style = array(
'border' => 2,
'vpadding' => 'auto',
'hpadding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false, //array(255,255,255)
'module_width' => 1, // width of a single module in points
'module_height' => 1 // height of a single module in points
);
$pdf->write2DBarcode('http://art105.tyc.edu.tw/m/?qr='.$work_id, 'QRCODE,L', 130, 185, 50, 50, $style, 'N');
沒有留言:
張貼留言