Skip to content

[Bug]: Re-rendering a pdf document crashes the website #20466

@Soberian

Description

@Soberian

Attach (recommended) or Link to PDF file

I'm making an informational website for company internal usage where I need to display various pdf documents as thumbnails + 1 document in full view. Every document is embedded as an iframe.

Sadly I didn't manage to get the supplied viewer.html to do exactly what I needed (no padding, no toolbar, no scroll bars, hide cursor when inactive, etc...) so I created a light weight "mini viewer" which essentially consists of modified code examples provided by you so it would render a pdf the way I need.

Right now I'm facing the problem that auto-refreshing the PDF bloats the memory usage until the site eventually crashes.

Example-iframe to reproduce the problem (without the File-parameter it will load the default example pdf):

<iframe src="./pdfjs/web/viewer_mini.html?Refresh=1" style="width:80vw; height:80vh"></iframe>

The following files must be dropped in the '..\pdfjs\web' directory. Rename the viewer_mini_controls.mjs.txt to viewer_mini_controls.mjs). I added a few comments here and there trying to explain the usage if anyone is interested.

viewer_mini.html
viewer_mini_controls.mjs.txt

Web browser and its version

MS Edge 138, MS Edge 142

Operating system and its version

Windows 10 , Windows 11

PDF.js version

5.4.394

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

Create an HTML File with an IFrame containing the viewer_mini.html (both linked files must be dropped in the '..\pdfjs\web' directory. Rename the viewer_mini_controls.mjs.txt to viewer_mini_controls.mjs).
For accelerated testing purpose set Refresh=1 (the default PDF will be loaded and refreshed every second)

<iframe src="./pdfjs/web/viewer_mini.html?Refresh=1" style="width:80vw; height:80vh"></iframe>

-> Watch your memory usage steadily rising.

What is the expected behavior?

The memory usage should not increase

What went wrong?

Website eventually crashes.

Link to a viewer

No response

Additional context

No response

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