The --margin-top
option is for the contents margin, but I would like to set the margin from the top of the page to the header. The project I'm working on allows users to create header and footer themselves, so the height of the header or footer is dynamic.
I don't know how to do it so can anyone help?
The built-in options for top margin are
--margin-top
(as you mentioned above) and--header-spacing
Spacing between header and content in mm (refer: http://wkhtmltopdf.org/usage/wkhtmltopdf.txt). None of them will probably help you as there is no option (at least to my knowledge) that can explicitly set some margin from the top of the page to the header. However, in your case, you could explore --header-html <url>
and add a html header. This can take an HTML where you could probably set the custom header and add space/margin accordingly and then the HTML gets displayed in on the header.