我试图在
PHP中使用tcpdf生成pdf.如果我在浏览器中打开它比一切都好.没有错误但是如果保存或下载文件而不是pdf文件中只有复选框的值是可见的,它只是在第一个复选框的值之前放置复选标记.
预期输出:所有复选框都正确显示.如何为所有值添加复选框(刻度线方块)?
这是我的代码:
error_reporting(0);
$file = "PDF.csv";
$handle = fopen($file,"r");
$data= fgetcsv($handle);
$job_no=$data[0];
$postcode=$data[1];
$address=$data[2];
$order_no=$data[4];
$d_date=$data[5];
$product=$data[8];
$myArray = explode(utf8_encode(''), $product);
$date = DateTime::createFromFormat("Y-m-d", $d_date);
$filename="General ". $date->format("d"). $date->format("M").$y=$date->format("y").".pdf";
$filepath="C:\\Users\\Admin\\Documents\\pdf";
require_once('tcpdf_include.php');
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetCreator(PDF_CREATOR);
$pdf->setFooterData(array(0,64,0), array(0,64,128));
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// add a page
$pdf->AddPage();
$pdf->SetFont('times', '',11);
$pdf->setPage(1, true);
$txt = '
.height1
{
height:1000px;
}
Electrician Painter Specialist company |
$pdf->writeHTML($txt,1,null,null,null,null);
// ---------------------------------------------------------
$fileNL = $filepath."\\".$filename;
$pdf->Output($fileNL,'F');
?>