gpt4 book ai didi

pdf - 如何在 TCPDF 中实现自定义字体

转载 作者:行者123 更新时间:2023-12-03 06:44:00 25 4
gpt4 key购买 nike

在 TCPDF 中,只有几种字体可供选择来创建 pdf 文件。我想将 Tahoma 设置为我的 pdf 字体。如何将 Tahoma 包含在 TCPDF 中?

最佳答案

最新的 TCPDF 版本使用 addTTFfont() 方法自动将字体转换为 TCPDF 格式。例如:

// convert TTF font to TCPDF format and store it on the fonts folder
$fontname = TCPDF_FONTS::addTTFfont('/path-to-font/FreeSerifItalic.ttf', 'TrueTypeUnicode', '', 96);

// use the font
$pdf->SetFont($fontname, '', 14, '', false);

有关更多信息和示例,请查看TCPDF Fonts documentation page .

注意:转换字体后,TCPDF 不再需要 TTF 文件或上述对 addTTFfont() 的调用!

关于pdf - 如何在 TCPDF 中实现自定义字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5263588/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com