我已经写了一些简单的脚本,将一些文本写入PDF,导致了php库TCPDF。 这是脚本:用TCPDF将空间写入PDF文件
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Label Creator');
$pdf->SetTitle('labels');
$pdf->SetSubject('Labels di prova');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE,0);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// set font
$pdf->SetFont('times', '', 15);
//left margin
$pdf->SetMargins(18,15,18,FALSE);
// add a page
$pdf->AddPage();
$label="Hello world, i'm michele";
$pdf->Cell(0, 0 , $label, 0, 1, 'C', 0, '', 0,FALSE,'T','M');
//Close and output PDF document
$pdf->Output('../../labels.pdf', 'F');
echo 'Labels generate!';
的问题是,脚本工作,但在文件中我会看到不带空格的文字!像这样: helloworld,i'mmichele 有没有人有解决方案?!!?
什么是<<< EOD和EOD; ?? – trullallero
对不起,但$标签=“你好世界,我是米歇尔”; $ pdf->单元格(0,0,$标签,1,1,'C',0,'',3;不写空格... – trullallero
我解决了,问题是浏览器的PDF插件可视化工具!! – trullallero