作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经使用 UTF-8 字符制作了一个 pdf。但是,在 tcpdf 中不能使用 utf-8。
代码:
<?php
require_once('tcpdf/tcpdf_import.php');
// 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('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 008');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
// 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);
// add a page
$pdf->AddPage();
// get esternal file content
$utf8text = "私、本書に署名する目的は、法律で認められている最大範囲において、SNUBA ガイド、";
// set color for text
$pdf->SetTextColor(0, 63, 127);
//Write($h, $txt, $link='', $fill=0, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0)
// write the text
$pdf->Write(5, $utf8text, '', 0, '', false, 0, false, false, 0);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_008.pdf', 'I');
?>
????????????????????????????????SNUBA ????
最佳答案
我认为您使用了错误的字体。
我遇到了同样的问题,然后我将字体从“helvetica”更改为“dejavusans”并开始工作。
关于php - 如何在 TCPDF 中支持 UTF-8?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37947426/
我是一名优秀的程序员,十分优秀!