Replies: 1 comment
|
On iOS WebKit, this is usually a memory-pressure problem. There is not really a single pdf.js option that prevents it if the app renders and keeps many pages/canvases alive at the same time. The main fix is to render fewer pages at once and release resources aggressively. Things I would try:
Conceptually: const renderTask = page.render({ canvasContext, viewport })
// When the page leaves the viewport:
renderTask.cancel()
canvas.width = 0
canvas.height = 0
page.cleanup()If you are using pdf.js directly, I would implement virtual scrolling / page recycling. Keep maybe 2–5 pages rendered, not the whole document. Also, So the answer is mostly: control memory at the viewer level by lazy-rendering and cleaning up pages, rather than trying to render the whole PDF and relying on pdf.js to fit it into iOS memory. |
Uh oh!
There was an error while loading. Please reload this page.
How to control memory overflow ?
All reactions