如何使用tcpdf和php打印多行

时间:2014-03-03 01:37:40

标签: php tcpdf

我正在尝试将动态报告打印到pdf。我需要在页面上写多行,虽然我发现的所有内容似乎都只限于一个文本行。 如何在文档的多个位置/ x,y上写多行? http://i.imgur.com/aO7hIO6.png 我的问题与此https://stackoverflow.com/questions/8389550/tcpdf-multiple-writecell-on-a-line相同,但从未得到解答。

第65行无法显示/显示。

<?php

ob_start();
session_start();

$printdata = $_SESSION['printdata'];
$pieces = explode(":", $printdata);

require_once('/var/www/localhost/htdocs/contactdb/tcpdf/examples/tcpdf_include.php');
require_once('/var/www/localhost/htdocs/contactdb/tcpdf/examples/lang/eng.php');
require_once('/var/www/localhost/htdocs/contactdb/tcpdf/tcpdf.php');

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);


// set margins
//$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);

// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);


// -------------------------------------------------------------------

// add a page
$pdf->AddPage();

// set JPEG quality
$pdf->setJPEGQuality(75);


// Image example with resizing
$pdf->Image('edit1forbrad_program.jpg', 10, 10, 480, 680, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

$txt1 = "Some sample text".$pieces[0];
$txt2 = $pieces[1];
$txt3 = "".$pieces[2];
$txt4 = "".$pieces[3];
$txt5 = "".$pieces[4];
$txt6 = "".$pieces[5];
$txt7 = "".$pieces[6];
$txt8 = "".$pieces[7];
$txt9 = "".$pieces[8];
$txt10 = "".$pieces[9];
$txt11 = "".$pieces[10];
$txt12 = "".$pieces[11];
$txt13 = "".$pieces[12];
$txt14 = "".$pieces[13];
$txt15 = "".$pieces[14];
$txt16 = "".$pieces[15];
$txt17 = "".$pieces[16];


$pdf->SetFont('times', '', 16);
$pdf->SetX(30);
$pdf->Write(150, $txt2, '', 0, 'L', true, 0, false, false, 0);

$pdf->MultiCell(180, $txt2, '', 0, 'L', true, 0, false, false, 0);

//Close and output PDF document
$pdf->Output('example_009.pdf', 'I');

0 个答案:

没有答案