douzhong1907 2012-03-16 22:47
浏览 58

在dompdf中使文本变粗或变大

I just started using dompdf v0.6.0beta3 and the dompdf Codeigniter helper with Codeigniter. I have copied the Arial font family tff files from Windows 7 font folder to dompdf's /lib/fonts folder.

Problem: When I select a text using CSS and apply the font-weight: bold property, on the HTML output it is indeed bold, but after converting to PDF via dompdf, the text is no longer in bold!

font-size: 24px does not work, all text in the pdf are the same sizes. And the only font being used in the pdf appears to be Times New Roman!

How can I make my text bold and change its size and font in the pdf?

PHP (Controller)

function pdf() {

    $this->load->model('resume_model');
    $results = $this->resume_model->get_resume_details($user_id);

    $this->load->helper(array('dompdf', 'file'));
    $html = $this->load->view('resume_pdf', $results, true);
    pdf_create($html, 'filename');

}
  • 写回答

1条回答 默认 最新

  • dsideal2015 2012-03-17 00:32
    关注

    Is your stylesheet external to your HTML content? If so you may just have a path problem. The plugin appears to use $dompdf->load_html() to load the document. DOMPDF has no knowledge of your website when used in this way and will work off the local file system. What this means for you is that file paths are relative to the currently-executing file. If the path is absolute (e.g. /css/main.css) then DOMPDF will look for this file off the root of the file system. Instead of looking for the file at /wwwroot/content/css/main.css it will look for /css/main.css.

    The quickest fix, if this is your problem, would be to add a full URL, including domain, to your file references (e.g. http://example.com/css/main.css).

    评论

报告相同问题?

悬赏问题

  • ¥15 求解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波