Skip to content

Temporary iframe creation causes visible scrollbar flicker when generating large PDFs #214

@wabualhi

Description

@wabualhi

When using dom-to-image-more to generate a PDF (especially from large DOM elements), the library temporarily creates an <iframe> in the document.
This iframe becomes briefly visible, which causes a vertical scrollbar to appear on the screen for a moment before it is removed.

This results in a small but noticeable layout shift (flicker) during PDF generation.

Steps to Reproduce:

Use dom-to-image-more.toPng() or .toJpeg() on a large DOM element.

Generate a PDF using jsPDF or similar.

Observe the page while the process runs.

You’ll see a vertical scrollbar appear briefly, then disappear after the process finishes.

Expected Behavior:
The temporary iframe used internally for rendering should not affect the visible layout —
it should be created off-screen or hidden (position: fixed; top: -9999px; visibility: hidden;).

Actual Behavior:
A visible scrollbar appears briefly while the iframe exists.

"dom-to-image-more": "^3.7.1",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions