Wkhtmltopdf: Simple example HTML header and footer fails

Created on 8 Apr 2016  路  2Comments  路  Source: wkhtmltopdf/wkhtmltopdf

Hello,

I am using wkhtmltopdf and I am trying to add HTML pages as header and footer.

Here is the content of my pages:

header.html:

<html>
    <body>
        <h1>header</h1>
    </body>
</html>

content.html:

<html>
    <body>
        My content
    </body>
</html>

footer.html:

<html>
    <body>
        <h1>footer</h1>
    </body>
</html>

The following command line result a blank PDF file (see file attached):

/usr/local/bin/wkhtmltopdf --header-html "http://projects.local/Testing/wkhtmltopdf/header.html" --footer-html "http://projects.local/Testing/wkhtmltopdf/footer.html" "http://projects.local/Testing/wkhtmltopdf/content.html" "/Users/felixveysseyre/Projects/Testing/wkhtmltopdf/test.pdf"

I am doing something wrong ? I am using latest version released for Mac OS X: _wkhtmltopdf 0.12.3 (with patched qt)_

Thanks for your help

Question

Most helpful comment

Apparently, doctype is required to be rendered correctly.

I just added the following line and everything is fine now:
<!DOCTYPE html>

All 2 comments

Apparently, doctype is required to be rendered correctly.

I just added the following line and everything is fine now:
<!DOCTYPE html>

felixveysseyre You're absolutely right, it works for me too

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dhughesbc picture dhughesbc  路  4Comments

bparker06 picture bparker06  路  3Comments

8176135 picture 8176135  路  3Comments

caleywoods picture caleywoods  路  4Comments

prasadsurase picture prasadsurase  路  4Comments