From 25521d1a26f09aac0a7ffd1befc4a3bb4d7abc85 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 2 Dec 2014 11:03:07 +0000 Subject: [PATCH] insert the pdf text and annotations after the page has been rendered --- .../ide/pdfng/directives/pdfRenderer.coffee | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee index c4e9ab77dc..ccf30ee300 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee @@ -151,28 +151,27 @@ define [ textLayerDiv: element.text[0] viewport: viewport }) - page.getTextContent().then (textContent) -> - console.log 'text content is', textContent - window.RENDER_DELAY = 0 - textLayer.setTextContent textContent annotationsLayer = new pdfAnnotations({ annotations: element.annotations[0] viewport: viewport navigateFn: @navigateFn }) - page.getAnnotations().then (annotations) -> - console.log 'annotations are', annotations - window.RENDER_DELAY = 0 - annotationsLayer.setAnnotations annotations + + element.canvas.replaceWith(canvas) + canvas.removeClass('pdf-canvas-new') return @renderTask = page.render { canvasContext: ctx viewport: viewport } .then () -> - element.canvas.replaceWith(canvas) - canvas.removeClass('pdf-canvas-new') + page.getTextContent().then (textContent) -> + console.log 'text content is', textContent + textLayer.setTextContent textContent + page.getAnnotations().then (annotations) -> + console.log 'annotations are', annotations + annotationsLayer.setAnnotations annotations addSpinner: (element) -> h = element.height()