5 ms·
Love it, but unlike Chrome's embedded PDF reader, it can't "stream" PDFs (a dealbreaker for people viewing media-heavy PDFs on slower connections)
by aviraldg 14y ago
Love it, but unlike Chrome's embedded PDF reader, it can't "stream" PDFs (a dealbreaker for people viewing media-heavy PDFs on slower connections)
- baudehlo 14y agoThat's interesting, because PDFs are an inherently un-streamable format. It requires seeking within the file to work (hence why command line PDF tools can't take STDIN for the PDF file - or they fake it by copying to a temp file first). I wonder how google got around that problem.
- jevinskie 14y agoYou could try to progressively render the file, pausing when a required forward reference isn't within the data you have downloaded so far.
- jammmuel 14y agoThat seems to be what they do, in my experience.
- deleted 14y ago[deleted]
- benatkin 14y agoengineers gonna engineer
- hackmiester 14y agoWell, I imagine that they download the file in the background, and if the viewer seeks to a non-downloaded part of the file, then it just blocks with "Loading" until that part is downloaded.
- dunham 14y ago"Linearized" PDFs have extra info up front to allow streaming and random access (via range requests).
- jlarocco 14y agoActually, PDF files can be optimized for streaming: http://acroeng.adobe.com/wp/?page_id=27 http://acroeng.adobe.com/wp/?page_id=27 It's covered in Annex F of the PDF spec: https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf https://wwwimages2.adobe.com/content/dam/Adobe/en/devnet/pdf...
- fafner 14y agoIf I remember correctly the PDF Spec says the files should be read backwards. The object table is at the end of the file.
- brendandahl 14y agoWe're working on that https://github.com/mozilla/pdf.js/pull/2719 https://github.com/mozilla/pdf.js/pull/2719