1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Convert PDFDocumentLoadingTask, in src/display/api.js, to an ES6 class

Also deprecates the `then` method, in favour of the `promise` getter.
This commit is contained in:
Jonas Jenwald 2018-11-08 13:40:06 +01:00
parent 5f15dc2023
commit ef8e5fd77c
14 changed files with 82 additions and 68 deletions

View file

@ -49,7 +49,8 @@ function buildSVG(viewport, textContent) {
function pageLoaded() {
// Loading document and page text content
pdfjsLib.getDocument({url: PDF_PATH}).then(function (pdfDocument) {
var loadingTask = pdfjsLib.getDocument({url: PDF_PATH});
loadingTask.promise.then(function(pdfDocument) {
pdfDocument.getPage(PAGE_NUMBER).then(function (page) {
var viewport = page.getViewport(PAGE_SCALE);
page.getTextContent().then(function (textContent) {