From b893446b9c01d0989d3198ae74047b810f04a0e7 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 31 Mar 2015 14:54:36 +0100 Subject: [PATCH] use new pdfjs getDestination method in pdfRenderer gives faster lookup of link destinations in pdf file --- .../ide/pdfng/directives/pdfRenderer.coffee | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee b/services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee index a797c46865..aa0c7d5405 100644 --- a/services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee +++ b/services/web/public/coffee/ide/pdfng/directives/pdfRenderer.coffee @@ -60,22 +60,10 @@ define [ pdfDocument.getDestinations() getDestination: (dest) -> - # There is a direct method for this in pdf.js but it is not - # available in pdf.js-1.0.712. Use the following workaround of - # getting all the destinations and returning only the one we - # want. - @destinations = @document.then (pdfDocument) -> - pdfDocument.getDestinations() - return @destinations.then (all) -> - all[dest] + @document.then (pdfDocument) -> + pdfDocument.getDestination(dest) , (error) => @errorCallback?(error) - # When we upgrade we can switch to using the following direct - # code. - # @document.then (pdfDocument) -> - # pdfDocument.getDestination(dest) - # , (error) -> - # console.log 'ERROR', error getPageIndex: (ref) -> @document.then (pdfDocument) =>