1
votes

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
maybe this could help you: code.google.com/p/dompdf/wiki/FAQ and search for boldAlex
cant bold text be set using css's font-weight: bold property? Thats what I am seeing from the dompdf samples pxd.me/dompdf/www/examples.php#samplesNyxynyx

1 Answers

1
votes

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).