Merge pull request #14328 from Snuffleupagus/node-examples-page-cleanup
Update (primarily) the Node.js examples to release page resources
This commit is contained in:
commit
aee4b7c73f
@ -53,6 +53,8 @@ loadingTask.promise
|
|||||||
});
|
});
|
||||||
console.log("## Text Content");
|
console.log("## Text Content");
|
||||||
console.log(strings.join(" "));
|
console.log(strings.join(" "));
|
||||||
|
// Release page resources.
|
||||||
|
page.cleanup();
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
console.log();
|
console.log();
|
||||||
|
@ -103,6 +103,8 @@ const loadingTask = pdfjsLib.getDocument({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Release page resources.
|
||||||
|
page.cleanup();
|
||||||
} catch (reason) {
|
} catch (reason) {
|
||||||
console.log(reason);
|
console.log(reason);
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,8 @@ const loadingTask = pdfjsLib.getDocument({
|
|||||||
svgGfx.embedFonts = true;
|
svgGfx.embedFonts = true;
|
||||||
const svg = await svgGfx.getSVG(opList, viewport);
|
const svg = await svgGfx.getSVG(opList, viewport);
|
||||||
await writeSvgToFile(svg, getFilePathForPage(pageNum));
|
await writeSvgToFile(svg, getFilePathForPage(pageNum));
|
||||||
|
// Release page resources.
|
||||||
|
page.cleanup();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(`Error: ${err}`);
|
console.log(`Error: ${err}`);
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,8 @@ async function pageLoaded() {
|
|||||||
// building SVG and adding that to the DOM
|
// building SVG and adding that to the DOM
|
||||||
const svg = buildSVG(viewport, textContent);
|
const svg = buildSVG(viewport, textContent);
|
||||||
document.getElementById("pageContainer").appendChild(svg);
|
document.getElementById("pageContainer").appendChild(svg);
|
||||||
|
// Release page resources.
|
||||||
|
page.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user