Closed khuuthanh96 closed 2 years ago
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 https://github.com/SebastiaanKlippert/go-wkhtmltopdf/issues/28
It has some possible workarounds.
See https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3014 and https://github.com/wkhtmltopdf/wkhtmltopdf/issues/4981 Nothing I can do at this moment.
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 :cry:
As I guessed It's because css relative path not work when the html file is stored in buffer memory. Is It correct?