Closed jtauber closed 8 months ago
This may indeed need to be clarified somewhere, this behavior is not really well documented. Similarly to #47 , using absolute paths for files within <link ref="stylesheet" ...>
should do the trick. This is because HTML2Image uses a temporary directory to allow the use of both HTML/CSS files and strings: files are copied to this directory and strings are converted+written as files in this directory.
Alternatively, if you only use existing files and not strings, you could change the temporary directory to the root directory of your html_file, like so:
from html2image import Html2Image
hti = Html2Image(temp_path='./') # assuming the root of your project is the current directory
...
Thank you for such a quick and helpful response!
I'm running html2image with local html+css.
I'm confused by the interaction of having a
<link ref="stylesheet" ...>
in the html vs specifying it viacss_file
. I seem to need both to get things to work.It also appears it won't work if these are paths. I have to have my html and css in the same directory for any of it work.
Or am I just missing something?