This commit is contained in:
wangjinlei
2022-06-24 10:34:21 +08:00
parent 8930873c92
commit f218969af8
605 changed files with 1891 additions and 146381 deletions

View File

@@ -31,29 +31,29 @@ require_once('tcpdf_include.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 057');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
$pdf->setCreator(PDF_CREATOR);
$pdf->setAuthor('Nicola Asuni');
$pdf->setTitle('TCPDF Example 057');
$pdf->setSubject('TCPDF Tutorial');
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 057', PDF_HEADER_STRING);
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 057', PDF_HEADER_STRING);
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->setDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->setMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->setHeaderMargin(PDF_MARGIN_HEADER);
$pdf->setFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
@@ -67,24 +67,24 @@ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
// ---------------------------------------------------------
// set font
$pdf->SetFont('helvetica', 'B', 20);
$pdf->setFont('helvetica', 'B', 20);
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of alignment options for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
$pdf->setFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(0.7);
$pdf->setLineWidth(0.7);
// set color for cell border
$pdf->SetDrawColor(0,128,255);
$pdf->setDrawColor(0,128,255);
$pdf->setCellHeightRatio(3);
$pdf->SetXY(15, 60);
$pdf->setXY(15, 60);
// text on center
$pdf->Cell(30, 0, 'Top-Center', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'C');
@@ -95,7 +95,7 @@ $pdf->Cell(30, 0, 'Baseline-Center', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'C');
$pdf->Cell(30, 0, 'Descent-Center', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'C');
$pdf->SetXY(15, 90);
$pdf->setXY(15, 90);
// text on top
$pdf->Cell(30, 0, 'Top-Top', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'T');
@@ -106,7 +106,7 @@ $pdf->Cell(30, 0, 'Baseline-Top', 1, $ln=0, 'C', 0, '', 0, false, 'L', 'T');
$pdf->Cell(30, 0, 'Descent-Top', 1, $ln=0, 'C', 0, '', 0, false, 'D', 'T');
$pdf->SetXY(15, 120);
$pdf->setXY(15, 120);
// text on bottom
$pdf->Cell(30, 0, 'Top-Bottom', 1, $ln=0, 'C', 0, '', 0, false, 'T', 'B');
@@ -150,7 +150,7 @@ TW: text width
FA: font ascent
FB: font baseline
FD: font descent';
$pdf->SetFont('helvetica', '', 10);
$pdf->setFont('helvetica', '', 10);
$pdf->setCellHeightRatio(1.25);
$pdf->MultiCell(0, 0, $legend, 0, 'L', false, 1, 125, 160, true, 0, false, true, 0, 'T', false);
@@ -161,20 +161,20 @@ $pdf->MultiCell(0, 0, $legend, 0, 'L', false, 1, 125, 160, true, 0, false, true,
// add a page
$pdf->AddPage();
$pdf->SetFont('helvetica', 'B', 20);
$pdf->setFont('helvetica', 'B', 20);
$pdf->Write(0, 'Example of borders for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
$pdf->setFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(0.508);
$pdf->setLineWidth(0.508);
// set color for cell border
$pdf->SetDrawColor(0,128,255);
$pdf->setDrawColor(0,128,255);
// set filling color
$pdf->SetFillColor(255,255,128);
$pdf->setFillColor(255,255,128);
// set cell height ratio
$pdf->setCellHeightRatio(3);
@@ -218,20 +218,20 @@ $pdf->Cell(30, 0, 'B', 'B', 1, 'C', 1, '', 0, false, 'T', 'C');
// add a page
$pdf->AddPage();
$pdf->SetFont('helvetica', 'B', 20);
$pdf->setFont('helvetica', 'B', 20);
$pdf->Write(0, 'Example of advanced border settings for Cell()', '', 0, 'L', true, 0, false, false, 0);
$pdf->SetFont('helvetica', '', 11);
$pdf->setFont('helvetica', '', 11);
// set border width
$pdf->SetLineWidth(1);
$pdf->setLineWidth(1);
// set color for cell border
$pdf->SetDrawColor(0,128,255);
$pdf->setDrawColor(0,128,255);
// set filling color
$pdf->SetFillColor(255,255,128);
$pdf->setFillColor(255,255,128);
$border = array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0)));
$pdf->Cell(30, 0, 'LTRB', $border, 1, 'C', 1, '', 0, false, 'T', 'C');