Search code examples
phpcodeigniterdompdffgetcsv

DomPDF Codeigniter charset not correctly rendered


I have a nifty problem with DomPDF, it does bug-up accented characters. I did everything that Phil Sturgeon suggests on Phil Sturgeon on UTF-8 support for Codeigniter But with the only result that the first page of the PDF is okay but the rest is wrong.

Anyone any suggestions or solutions?

B.t.w. I import through a csv-file with PHP fgetcsv(), my php-array looks good.


Solution

  • Finally solved it:

    First I took all the steps Phil Sturgeon suggested, except later on I found out I need to remove the META setting.

    Before putting out the HTML to DomPDF, I did a PHP

    $html = utf8_decode($html);
    

    But before that you need to remove the META Charset from your HTML. And be sure to add the proper page-ends in your document, I used a div with some CSS

    <div style="page-break-before:always"></div>
    

    on the end of each chapter.