SebastiaanKlippert/go-wkhtmltopdf

Question : add constant header and footer

georgeroumieh-pon opened this issue · 5 comments

I have an HTML template and I put it in bytes. Buffer and it returns a pdf. awesome, thank you for your work.
I want to add a constant header and footer but it's not working in my local
I tried all of this to implement footer but didn't work :
page.FooterHTML.Set("./footer.html")
page.FooterHTML.Set("file:///footer.html")
thanks in advance

Can you try page.EnableLocalFileAccess.Set(true)?

I am trying just to test add footer and I put the HTML file in my root folder but always the error :
error: Loading pages (1/6)
Error: Failed to load http://footer.html/, with network status code 3 and http status code 0 - Host footer.html not found
Error: Failed loading page http:/footer.html (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: HostNotFoundError

In your example you have two lines calling FooterHTML.Set, is that the same in your code?
It is trying to get the file online and not from disk, the file:/// prefix should be OK and work.
Are you sure that footer.html is located in the right place? Try an absolute path as well (file:///C:/footer.html) to debug.
Is footer.html only containing HTML or scripts as well?

Thanks, it's working now @SebastiaanKlippert