Question

I am trying to add some text the top of an html image using wkhtmltoimage. I am not sure if I am using the right argument. At the moment, I am failing with...

wkhtmltoimage --custom-header helloworld http://www.google.com google.png

The help file suggests I need a value after the text. It is not clear to me what this represents. I also would like to add more than one word (e.g. hello world). Is this possible?

Was it helpful?

Solution

--custom-header is for sending HTTP request headers to a URL, not for making headers as you would in a word processor.

For example, if you have a multilingual website that responds to the Accept-Language request header, you can request a specific language version by sending the custom header:

wkhtmltopdf --custom-header Accept-Language fr-CA http://www.google.com google.pdf

In this example, --custom-header is used to request the Canadian-French (fr-CA) version of Google.

What you're probably looking for is the --header-html option, which is available with wkhtmltopdf (but not with wkhtmltoimage, from what I can tell):

wkhtmltopdf --header-html /path/to/your/header/file.html http://www.google.com google.pdf

In this example, whatever HTML code is found in /path/to/your/header/file.html file gets prepended as the header.

Read more about all of the header/footer options in the manual.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top