-
-
Notifications
You must be signed in to change notification settings - Fork 48
Description
I'm implementing a function that converts large html files to image files (png).
For that, I have been using html2image successfuly in the past. However, after updating Microsoft Edge to 141.0.3537.9, html2image stops saving output files when using Edge as the browser backend. The call returns without any error and no image file is created. Switching to a portable Chrome .exe based on Chromium 140.0.x makes the exact same code work again, so this looks like an error with Chromium/Edge 141. The portable Chrome Version is no long-term solution for my use case.
Here's my code for the image generation (html2image version 2.0.7 is used):
hti = Html2Image(
output_path=os.path.dirname(output_file),
custom_flags=[
"--default-background-color=FFFFFF",
"--start-fullscreen",
"--headless",
"--virtual-time-budget=600",
"--hide-scrollbars",
f"--window-size={self.image_resolution[0]},{self.image_resolution[1]}",
],
browser="edge",
browser_executable=r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe",
)
hti.browser.use_new_headless = None
html = self.map.get_root().render()
screenshot_files = hti.screenshot(html_str=html, save_as=os.path.basename(output_file))
screenshot_file = screenshot_files[0]
I already tried using different flags, but no change. I also considered alternative libraries: Imgkit/wkhtmltopdf doesn't seem to be active anymore; Qt5 is running into problems with the setHtml() function once html files are getting large.
Any help would be appreciated!