dealfonso / pdfjs-viewer

A viewer based on PDFjs, which can be embedded in any web page (not using iframes)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pixel Ratio causes crashes on iPads

bentalentville opened this issue · comments

Just wanted to bring up a possible issue in that using the pixel ratio value that you have in the viewer to determine the rendering canvas size can cause so much memory to be needed for full screen display on high res screens (I believe on my iPad the ratio is 2), that it crashes my site with longish documents on iOS devices. Hard coding the pixel ratio to 1 and then using the rendering scale that you recently added for more sharpness stopped all the crashes. It never crashes on my Windows computer with Chrome even with a rendering scale of 4, but my iPadd has been crash city until I overrode the pixel ration variable.

I am still mystified by the lack of character crispness of pdfjs version 3.x (which I am using), it seems that version 1 of pdfjs was VERY sharp with text-based documents but with the 'newer' versions is a bit fuzzy unless I up the rendering scale. Some sort of nonsense anti aliasing or something? Sheesh. If version 1 would render the latest versions of PDFs I would just use that, but some newer pdfs get a parse error and show just blank pages.

Hi,
not sure why it would crash. I followed the examples and advice from pdfjs official docs [1], but I'll take a look at it.

Well, since I set pixel_ratio = 1; in the renderpage function and use renderingScale: 1.25 as the default scale option, it works perfectly and the crashing is gone on iOS devices like my iPad. Can't remember if I tried it with a higher rendering scale, but the quality is fine at 1.25, for my purposes anyhow.

Note that the documents I display are around 100 pages long but they almost all text-based, no graphics of any sort or even embedded images. I also set extraPagesToLoad to 2 to try to preload fewer pages.

Not sure if you propose if I should debug anything... if you think so, please re-open the issue.

Thank you.