pdf.js/examples/node
Rob Wu 0cc1735809 Reduce concurrent memory footprint of pdf2svg.js
Wait for the completion of writing the generated SVG file before
processing the next page. This is to enable the garbage collector to
garbage-collect the (potentially large) SVG string before trying to
allocate memory again for the next page.

Note that since the PDF-to-SVG conversion is now sequential instead of
parallel, the time to generate all pages increases.

Test case:
node --max_old_space_size=200 examples/node/pdf2svg.js /tmp/FatalProcessOutOfMemory.pdf

Before this patch:
- Node.js crashes due to OOM after processing 20 pages.

After this patch:
- Node.js is able to convert all 203 PDFs to SVG without crashing.
2017-06-19 21:53:11 +02:00
..
pdf2png Adds gulp dist-install command; using pdfjs-dist package in examples. 2017-06-12 10:22:16 -05:00
domparsermock.js Uses editorconfig to maintain consistent coding styles 2015-11-14 07:32:18 +05:30
domstubs.js Improve memory-efficiency of DOMElement_toString in domstubs 2017-06-19 21:52:39 +02:00
getinfo.js Adds gulp dist-install command; using pdfjs-dist package in examples. 2017-06-12 10:22:16 -05:00
pdf2svg.js Reduce concurrent memory footprint of pdf2svg.js 2017-06-19 21:53:11 +02:00