iOS Safari crash when opening PDF

Aperta
#692 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
30/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
angular, ios, typescript
Ambito
frontend

Direzione di ricerca

Reproduce first: run the reporter's demo repo (Sckoco/pdf-crash-demo) on iOS Safari with src/assets/sample.pdf and watch memory while the viewer initializes around EmbedPDF.init(). The workaround pins window.devicePixelRatio to 1.5, so trace where the render/tiling layer reads devicePixelRatio and how tiles are buffered for large images; the render plugin's tiling config is the other lead. Done means the document loads on iOS Safari at the default ratio without the page reloading.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment

@embedpdf/snippet 2.14.3
@angular/* 19.2.18
iOS Safari only

Summary

When trying to load a PDF file containing a large image inside, the viewer initializes correctly, but while the document is loading, the page reloads/crashes and the document never finishes loading. This only happens on iOS Safari — I haven't been able to reproduce it on desktop browsers.

I've been able to reproduce this same behavior with the same document on the live demo on the EmbedPDF website (tested on iOS Safari), so it doesn't appear to be specific to my setup.

As mentioned on the "Render plugin" page of the documentation, I already tried reducing the tile size in the tiling config to lower memory usage, but this did not resolve the issue.

A public repo is available on my profile to reproduce this issue. A sample PDF is provided at src/assets/sample.pdf.

Workaround

Reduce the DevicePixelRatio right before calling EmbedPDF.init() method.

Object.defineProperty(window, 'devicePixelRatio', {
   get: () => 1.5,
   configurable: true
});

To avoid affecting anything else in the application, this is done only when this is running on an iOS device and on the destruction of the component, the devicePixelRatio is set back to its default value.

Demo

https://github.com/Sckoco/pdf-crash-demo

Lingua principale
TypeScript
Stelle
4.5k
Fork
317
Merge medio
10h 16m
PR unite (30g)
174

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di embedpdf/embed-pdf-viewer

Tutte le issue di embedpdf/embed-pdf-viewer

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.