Initialize the textLayerFactory
once in BaseViewer.setDocument
, rather than repeating it for every page
For reasons that I don't even pretend to understand, the `textLayerFactory` property is determined for *every single* page in the PDF document. Given that the `TextLayerMode` should be consistent for *all* pages in a document, we obviously could/should define `textLayerFactory` just once instead.
This commit is contained in:
parent
1fac29d184
commit
3eb4c1940d
@ -453,11 +453,10 @@ class BaseViewer {
|
|||||||
|
|
||||||
const scale = this.currentScale;
|
const scale = this.currentScale;
|
||||||
const viewport = firstPdfPage.getViewport({ scale: scale * CSS_UNITS });
|
const viewport = firstPdfPage.getViewport({ scale: scale * CSS_UNITS });
|
||||||
|
const textLayerFactory =
|
||||||
|
this.textLayerMode !== TextLayerMode.DISABLE ? this : null;
|
||||||
|
|
||||||
for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
for (let pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
||||||
let textLayerFactory = null;
|
|
||||||
if (this.textLayerMode !== TextLayerMode.DISABLE) {
|
|
||||||
textLayerFactory = this;
|
|
||||||
}
|
|
||||||
const pageView = new PDFPageView({
|
const pageView = new PDFPageView({
|
||||||
container: this._setDocumentViewerElement,
|
container: this._setDocumentViewerElement,
|
||||||
eventBus: this.eventBus,
|
eventBus: this.eventBus,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user