diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index fc68ee04d..83b312aa3 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -129,12 +129,10 @@ var PDFPageView = (function PDFPageViewClosure() { } div.removeAttribute('data-loaded'); - if (keepAnnotations) { - if (this.annotationLayer) { - // Hide annotationLayer until all elements are resized - // so they are not displayed on the already-resized page - this.annotationLayer.hide(); - } + if (currentAnnotationNode) { + // Hide annotationLayer until all elements are resized + // so they are not displayed on the already-resized page + this.annotationLayer.hide(); } else { this.annotationLayer = null; } @@ -303,7 +301,7 @@ var PDFPageView = (function PDFPageViewClosure() { var canvas = document.createElement('canvas'); canvas.id = 'page' + this.id; canvasWrapper.appendChild(canvas); - if (this.annotationLayer) { + if (this.annotationLayer && this.annotationLayer.div) { // annotationLayer needs to stay on top div.insertBefore(canvasWrapper, this.annotationLayer.div); } else { @@ -350,7 +348,7 @@ var PDFPageView = (function PDFPageViewClosure() { textLayerDiv.className = 'textLayer'; textLayerDiv.style.width = canvas.style.width; textLayerDiv.style.height = canvas.style.height; - if (this.annotationLayer) { + if (this.annotationLayer && this.annotationLayer.div) { // annotationLayer needs to stay on top div.insertBefore(textLayerDiv, this.annotationLayer.div); } else {