使用TCPDF将空间写入PDF文件 [英] Write space with TCPDF into a PDF file

查看:125
本文介绍了使用TCPDF将空间写入PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的脚本,可以将一些文本写入PDF,这是通过php库TCPDF实现的. 这是脚本:

I've this simple script that write some text into a PDF trought the php library TCPDF. This is the script:

// 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!';

问题是脚本可以工作,但是在文件中我会看到文本没有空格!像这样: 你好,我 有人有解决方案吗?!??

the problem is that the script works, but in the file I'll see the text without spaces! Like this: helloworld,i'mmichele Does anyone have the solution?!!?

推荐答案

我已解决,问题是浏览器的PDF插件可视化工具存在错误!

这篇关于使用TCPDF将空间写入PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆