This project aims to implement Streams API polyfill for PDF.js, and use it for networking and rendering purpose. PDF.js current uses xhr for networking to fetch data, but it is inefficient in terms of memory as it has to buffer all the response. As xhr is an ever growing buffer, it stores all the data in its internal buffer, this uses lots of memory. Using Streams API, we can use the response incrementally and pass it for parsing and rendering as soon as it is received, hence there is no need to buffer the whole response. For rendering purpose, PDF.js makes chunks of data by parsing pdf commands in worker thread. After chunking the whole data, it is passed to the main thread for painting. Buffering the entire data in the worker thread uses a huge amount memory, and main thread also has to wait for the entire data to be parsed. This creates inefficiency in terms of memory and speed. Using Streams API, we can send the chunks from worker thread to main thread as soon as they are created, reducing the memory usage and increases speed. Since Streams API is a new technology, using it in PDF.js will test Firefox's implementation.

Organization

Student

Mukul Kumar

Mentors

  • Yury Delendik
close

2017