NewPageReader can not load css with relative path embedded in html file
khuuthanh96 opened this issue · 1 comments
I stored my html file and css at the same directory of main.go.
When I load my html file with NewPage("./x.html") then every work as normal. CSS was loaded beautifully. But when I read html file to bytes.Buffer and use NewPageReader(buffer) then It just load html without any css 😢
As I guessed It's because css relative path not work when the html file is stored in buffer memory. Is It correct?
Hello, yes you are correct.
It is a bug in wkhtmltopdf, but I think that will never be fixed now.
When using stdin (buffer in go) wkhtmltopdf sets the current working dir to /tmp
I left a similar issue open as well #28
It has some possible workarounds.
See wkhtmltopdf/wkhtmltopdf#3014 and wkhtmltopdf/wkhtmltopdf#4981
Nothing I can do at this moment.