add loadedCallback to pdfng, detects when pdf is fully loaded

This commit is contained in:
Brian Gough 2015-01-13 16:28:24 +00:00
parent 953821959d
commit 5e06043fcb
2 changed files with 5 additions and 1 deletions

View file

@ -19,6 +19,9 @@ define [
@navigateFn = @options.navigateFn
@spinner = new pdfSpinner
@resetState()
@document.then (pdfDocument) =>
pdfDocument.getDownloadInfo().then () =>
@options.loadedCallback()
resetState: () ->
@page = []

View file

@ -35,6 +35,8 @@ define [
$scope.$apply()
progressCallback: (progress) ->
$scope.$emit 'progress', progress
loadedCallback: () ->
$scope.$emit 'loaded'
})
# we will have all the main information needed to start display
@ -51,7 +53,6 @@ define [
]
# console.log 'resolved q.all, page size is', result
$scope.numPages = result.numPages
$scope.$emit "loaded"
@setScale = (scale, containerHeight, containerWidth) ->
$scope.loaded.then () ->