1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Update (primarily) the Node.js examples to release page resources

Given that Node.js doesn't support Workers, general PDF.js performance will be worse when compared to browsers. In an attempt to improve at least memory usage a little bit, update the Node.js examples to release page resources once parsing is done for that page.
This commit is contained in:
Jonas Jenwald 2021-11-30 13:11:50 +01:00
parent 700eaecddd
commit 487a7ddc7d
4 changed files with 8 additions and 0 deletions

View file

@ -118,6 +118,8 @@ const loadingTask = pdfjsLib.getDocument({
svgGfx.embedFonts = true;
const svg = await svgGfx.getSVG(opList, viewport);
await writeSvgToFile(svg, getFilePathForPage(pageNum));
// Release page resources.
page.cleanup();
} catch (err) {
console.log(`Error: ${err}`);
}