migrate away from deprecated APIs

- renderTextLayer: use textContentSource parameter instead of textContentStream
- renderTextLayer: pass a div for the container argument
This commit is contained in:
octocorvus 2023-03-17 21:51:19 +00:00 committed by Daniel Micay
parent f87941ea22
commit f5a1452a2d

View File

@ -137,10 +137,10 @@ function renderPage(pageNumber, zoom, prerender, prerenderTrigger=0) {
}
render();
const textLayerFrag = document.createDocumentFragment();
const newTextLayerDiv = textLayerDiv.cloneNode();
task = pdfjsLib.renderTextLayer({
textContentStream: page.streamTextContent(),
container: textLayerFrag,
textContentSource: page.streamTextContent(),
container: newTextLayerDiv,
viewport: viewport
});
task.promise.then(function() {
@ -148,14 +148,12 @@ function renderPage(pageNumber, zoom, prerender, prerenderTrigger=0) {
render();
const newTextLayerDiv = textLayerDiv.cloneNode();
newTextLayerDiv.style.height = newCanvas.style.height;
newTextLayerDiv.style.width = newCanvas.style.width;
if (useRender) {
textLayerDiv.replaceWith(newTextLayerDiv);
textLayerDiv = newTextLayerDiv;
}
newTextLayerDiv.appendChild(textLayerFrag);
if (cache.length === maxCached) {
cache.shift()