当生成PDF复选框不显示

kre*_*eya 5 php tcpdf

我米试图生成在PHP中使用TCPDF PDF格式.如果我在浏览器比万物打开它是fine.There没有错误,但如果保存或下载文件比PDF文件只复选框的值是可见的,之前第一个复选框的值,它只是把对勾.预期输出:所有checkboxs都显示properly.How为所有值添加复选框(刻度平方)?

这是我的代码:

<?php
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 = '<style type="text/css">
    .height1
    {
    height:1000px;
    }
    </style>
    <table border="1" cellpadding="6" cellspacing="0" width="100%" style="font-family:Arial, Helvetica, sans-serif">

    <tr>
    <td colspan="2">
 <input type="checkbox" name="product[]" value="Electrician"'.(in_array("Electrician",$myArray) ? ' checked="checked" ' : '') .'>Electrician
 <input type="checkbox" name="product[]" value="Painter"'.(in_array("Painter",$myArray) ? ' checked="checked" ' : '') .'>Painter
 <input type="checkbox" name="product[]" value="Specialist company"'.(in_array("Specialist company",$myArray) ? ' checked="checked" ' : '') .'>Specialist company
 </td>      </tr>

</table>';
$pdf->writeHTML($txt,1,null,null,null,null);
// ---------------------------------------------------------
$fileNL = $filepath."\\".$filename;
$pdf->Output($fileNL,'F');

?>
Run Code Online (Sandbox Code Playgroud)

Aan*_*shi 2

为所有复选框写不同的名称。

 <input type="checkbox" name="product1" value="Electrician"'.(in_array("Electrician",$myArray) ? ' checked="checked" ' : '') .'>Electrician
 <input type="checkbox" name="product2" value="Painter"'.(in_array("Painter",$myArray) ? ' checked="checked" ' : '') .'>Painter
<input type="checkbox" name="product3" value="Specialist company"'.(in_array("Specialist company",$myArray) ? ' checked="checked" ' : '') .'>Specialist company
Run Code Online (Sandbox Code Playgroud)