Q:
Use of large files when using PDFNetJS leads to out-of-memory exceptions. How can we mitigate these issues?
A:
Unfortunately, we cannot provide a hard-set rule for maximum file size when using PDFNetJS, since the functionality depends on whether the browser will allocate the necessary memory for a given file. This is something we will continue to address, and is something that will continue to improve as browser technology advances. Note also that loading from local (downloaded) files will be less likely to cause memory issues since we can read data directly from the file object.
XODO.com, a showcase of PDFTron's technology, packages PDFNetJS as XodoJS. On that platform, we have set the following conservative limits to avoid out-of-memory exceptions:
Chrome: 400 MB
Other browsers: 150 MB
These values are not baked into WebViewer, since these are not hard-set rules. Rather, you should see many fewer out-of-memory exceptions if these limits are enforced. But other usage patterns enable larger files to be used with a similarly low occurrence of out-of-memory exceptions; specifically:
1. It is preferred to reuse the same frame whenever possible for viewing multiple documents.
2. Local file access is usually better than URLs (although this is usually not possible since users often want to open a particular document from a server).
3. Avoid opening multiple iframes/documents at the same time.
4. Closing and reopening the browser can be helpful, mostly for IE.