Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary files in modified TEMP path are not automatically deleted for html_file option #175

Open
MarkusEmmm opened this issue Jan 28, 2025 · 0 comments

Comments

@MarkusEmmm
Copy link

MarkusEmmm commented Jan 28, 2025

' import Html2Image
temp_path = 'D:\temp\'
hti = Html2Image(output_path=path,
custom_flags=["--headless"],
temp_path=temp_path,
keep_temp_files=False)
hti.browser.use_new_headless = None

css = "body {background: white;}"

res = hti.screenshot(html_file=filename, css_str=css, save_as=name.replace('html','png'), size=size)'

While running above code I noticed that the temporary files do not get deleted in the designated location.
After I had issues with the system default TEMP driving increasing in size with large numbers of conversions, I switched to an alternate location.

I checked the method 'screenshot' and saw that temporary files only get deleted in the case of 'html_str' call.
However, for 'html_file' no such method was present. During the 'load_file' operation the original *.html got copied to the temp_path, but was never removed.

To fix I created a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant