【问题标题】:DomPDF loads font in local but not onlineDomPDF 在本地而不是在线加载字体
【发布时间】:2015-03-18 06:48:40
【问题描述】:

我想使用 Arial 作为我的 PDF 的字体。但它只适用于本地站点,而不是在线。我正在用 Codeigniter 做这个项目。下面是我的代码。

 @font-face {
    font-family: "arial";
    src: url('<?php  echo admin_asset_url();?>/arial.ttf');
   }
 body,h1,h2,h3,li,a,p,h4{
        font-family: "arial";
    }
function pdf_create($html, $filename='', $stream=TRUE) 
{
    require_once("dompdf/dompdf_config.inc.php");

    $dompdf = new DOMPDF();
    $dompdf->load_html($html);
    $dompdf->render();
    if ($stream) {
        $dompdf->stream($filename.".pdf");
    } else {
        return $dompdf->output();
    }
}

【问题讨论】:

    标签: php css codeigniter dompdf


    【解决方案1】:

    这可能是因为 domPDF 正在从您的服务器加载字体,当访问您的本地主机时,可能是您的计算机。

    另一方面,您的服务器可能没有安装 arial。因此它不起作用。

    查看this link 了解有关 domPDF 和字体的更多信息

    【讨论】:

    猜你喜欢
    • 2016-11-04
    • 2015-01-17
    • 1970-01-01
    • 1970-01-01
    • 2017-02-02
    • 2014-02-12
    • 1970-01-01
    • 2021-12-07
    • 1970-01-01
    相关资源
    最近更新 更多