首页 > 解决方案 > dompdf在完整的bodytag中放置相同的字体

问题描述

我已经在我的 dompdf 中安装了 tangerine。现在发生的事情是当我在我的 Windows 机器上尝试时它工作正常。但是在 ubuntu 中,当我将相同的代码放入 xampp 时,生成的 pdf 会被堆积起来。我只使用了带有 h3 标签的 tangerine 字体,但在生成的 pdf 中,字体样式被放置在整个正文中。这是我的 dompdf 设置

<?php
// Include autoloader
require_once 'dompdf/autoload.inc.php';

// Reference the Dompdf namespace
use Dompdf\Dompdf;

// Instantiate and use the dompdf class
$dompdf = new Dompdf(array('isPhpEnabled' => true));

// Load content from html file
ob_start();
include_once 'pdfcontent.php';
$output = ob_get_clean();
$dompdf->loadHtml($output);

//$dompdf->loadHtml($html);

// (Optional) Setup the paper size and orientation
$dompdf->setPaper('b4', 'landscape');

// Render the HTML as PDF
$dompdf->render();

// Output the generated PDF (1 = download and 0 = preview)
$dompdf->stream("funeral",array("Attachment"=>0));
?>

标签: phpdompdfgoogle-webfonts

解决方案


那么问题基本上出在缓存的 dompdf 文件上。我已删除 dompdf 文件夹并再次上传。现在它工作正常。


推荐阅读