wkhtmltopdf footer-html encoding utf-8

Ahmed Abdullah Saeed picture Ahmed Abdullah Saeed · Jan 30, 2014 · Viewed 23.5k times · Source

wkhtmltopdf --encoding utf-8 is not working for --footer-html.

I am using the following command. Both HTML files are also in utf8 format.

wkhtmltopdf  --dpi 120 -O Portrait --encoding 'utf-8' --footer-html /tmp/testFooter.html  /tmp/testMain.html  /tmp/testPDF.pdf

Both files have french characters. But in pdf footer have bad characters.

<html>
     <head>
        <title></title>
     </head>
    <body>
    <div style="width:95%;font-size:9pt;font-family:Arial;">
    <div style="border-top: 1px solid black;width: 100%;text-align: center;">
    test - Guérin 691BANNE - FRANCE - SA au capital 0 Euros -737 729 - Téléphone :  86 03</div></div>
    </body>
</html>

Following image is output enter image description here

Answer

martin picture martin · Apr 7, 2014

Try adding the following line in the HTML head element of the footer:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">