vgalin / html2image

A package acting as a wrapper around the headless mode of existing web browsers to generate images from URLs and from HTML+CSS strings or files.
MIT License
344 stars 44 forks source link

html2image 2.0.1 suddenly stopped saving images #109

Closed megaprimatus closed 1 year ago

megaprimatus commented 1 year ago

Hi I had this code that was worked before, now it doesn't. I cannot find what is wrong, Looked thru the code many time with no success. I hope someone can give me a hint. I have a code that generates html file in my local directory and then i need to convert it to img.

hti = Html2Image()
path = 'files/users/data/' + customer_number
filename = path + '/plot.html'
hti.output_path = path
hti.screenshot(html_file=filename, save_as='plot.png', size=(720, 800))

the path works fine to generate html but when I run hti.screenshot it dosen't convert it to png. Everything was OK before, now it is not. FileNotFoundError: [Errno 2] No such file or directory: 'files/users/data/192204/plot.png'

vgalin commented 1 year ago

Hi, have you taken a look at #103 ? To sum up, screenshotting is bugged in the latest chromium versions, it is possible to downgrade it or use an older portable version.

megaprimatus commented 1 year ago

Thank you for the quick reply. Is it the same with 2.0.2 version? Unfortunately I can’t control what version of Chrome the user will be using. Any suggestions will be very appreciated, thanks in advance :)

megaprimatus commented 1 year ago

Everything is back to normal after upgrading to 2.0.3 version. Thank You :)

vgalin commented 1 year ago

That's surprising, maybe a new Chromium version was released? I'll close this issue, feel free to reopen it if needed.