html2image icon indicating copy to clipboard operation
html2image copied to clipboard

Viewport is not full

Open edyyy19 opened this issue 7 months ago • 3 comments

Hi, im generating an HTML template which is the app then takes a screenshot of it and sends it into an discord embed message. The problem is that the viewport is not complete as you can see in the following image. I tried a lots of ways to repair it but i didnt succed. Some help please, thank you!

hti = Html2Image( output_path=tempfile.gettempdir(), browser_executable=None, # Use default browser custom_flags=[ "--no-sandbox", "--disable-web-security", "--disable-features=VizDisplayCompositor", "--disable-dev-shm-usage", "--disable-gpu", "--window-size=1100,680", ], ) image_path = os.path.join( tempfile.gettempdir(), f"final_match_{match_id.replace('#','')}.png" ) hti.screenshot( html_str=html_content, save_as=os.path.basename(image_path), size=(1100, 680), )

Document
<style>
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

    html,
    body {
        width: 1100px;
        height: 680px;
        margin: 0;
        padding: 0;

        font-family: 'Industry', sans-serif;
        font-weight: 400;
    }

Image

edyyy19 avatar May 29 '25 18:05 edyyy19

Which version are you using of html2image?

Proud-Wadhwa avatar Jun 09 '25 08:06 Proud-Wadhwa

Which version are you using of html2image?

Last version. I was thinking about using Firefox as browser. Any idea if there is the same issue?

edyyy19 avatar Jun 09 '25 11:06 edyyy19

O mesmo problema aconteceu comigo, alguem tem a solução?

Isabele4543 avatar Aug 01 '25 14:08 Isabele4543