mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
use new pdfjs getDestination method in pdfRenderer
gives faster lookup of link destinations in pdf file
This commit is contained in:
parent
0684fa36fd
commit
b893446b9c
1 changed files with 2 additions and 14 deletions
|
@ -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) =>
|
||||
|
|
Loading…
Reference in a new issue