【问题标题】:Yii TCPDF missing embed font in Corel Draw X6Yii TCPDF 在 Corel Draw X6 中缺少嵌入字体
【发布时间】:2014-06-26 22:44:53
【问题描述】:

我在 Yii 中使用这个扩展: http://www.yiiframework.com/extension/tcpdf/

我想使用外部字体写入 pdf 文件,例如: http://www.1001fonts.com/open-sans-font.html

这是我的代码:

    $pdf = Yii::createComponent('application.extensions.tcpdf.ETcPdf', 'P', 'cm', 'A4', true, 'UTF-8');
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor("Some Body");
    $pdf->SetTitle("TCPDF Example 002");
    $pdf->SetSubject("TCPDF Tutorial");
    $pdf->SetKeywords("TCPDF, PDF, example, test, guide");
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->AddPage();
    $fontRegular = $pdf->addTTFfont(Yii::getPathOfAlias('webroot') . '/OpenSans-Regular.ttf');
    $pdf->SetFont($fontRegular, "", 30);
    $pdf->Cell(0,10,"Example",1,1,'C');
    $pdf->Output("example_002.pdf", "I");

它有效,我可以阅读许多程序的 pdf,除了 Corel Draw 6X。当我打开 pdf 时,它以“缺少字体”的消息开头,我无法将它们替换为任何其他类型的字体。谁能告诉我应该如何添加 ttf 字体,或将其嵌入到 pdf 中?

提前致谢!

【问题讨论】:

    标签: php pdf yii fonts tcpdf


    【解决方案1】:

    所以问题在于 Corel Draw 。你必须安装字体。

    1)从here下载你的ttf字体

    2)解压并将字体复制到C:\Windows\Fonts

    3) 重新启动 Corel Draw 并通过创建文本字段并选择字体来确保新字体可用。

    Reference

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-17
      • 2016-09-29
      相关资源
      最近更新 更多