diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index 960529ba67b57..a5d5a138507bf 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -496,11 +496,6 @@ class PDFPageView { div.appendChild(textLayerDiv); } - if (this.xfaLayer?.div) { - // The xfa layer needs to stay on top. - div.appendChild(this.xfaLayer.div); - } - textLayer = this.textLayerFactory.createTextLayerBuilder( textLayerDiv, this.id - 1, @@ -511,6 +506,11 @@ class PDFPageView { } this.textLayer = textLayer; + if (this.xfaLayer?.div) { + // The xfa layer needs to stay on top. + div.appendChild(this.xfaLayer.div); + } + let renderContinueCallback = null; if (this.renderingQueue) { renderContinueCallback = cont => {