Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated API usage with examples #10377

Closed
7twin opened this issue Dec 24, 2018 · 4 comments
Closed

Deprecated API usage with examples #10377

7twin opened this issue Dec 24, 2018 · 4 comments
Labels

Comments

@7twin
Copy link

7twin commented Dec 24, 2018

Configuration:

  • Web browser and its version: Firefox 64.0
  • Operating system and its version: Windows 10
  • PDF.js version: '2.6.1' (included directly by //mozilla.github.io/pdf.js/build/pdf.js)
  • Is a browser extension: No

Steps to reproduce the problem:

  1. include via
  • <script src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
  1. set:
  • pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
  1. use examples from: https://mozilla.github.io/pdf.js/examples/

What went wrong? (add screenshot)

99733b699429b48a9982577efb14fdde

@timvandermeij
Copy link
Contributor

The examples have already been updated with this new API usage, just not yet on JSFiddle. @yurydelendik Could you perhaps update all examples on that page with the current code from the examples folder?

@yurydelendik
Copy link
Contributor

Fixed

@avimar
Copy link

avimar commented Oct 10, 2019

Came here because I was getting this error when upgrading from v1 to v2:

Deprecated API usage:  PDFDocumentLoadingTask.then method, use the `promise` getter instead.

In short, we now have to explicitly refer to .promise

//V1
const loadPDF = await PDFJS.getDocument(file);
const pages = loadPDF.numPages;


//V2
const loadPDF = await PDFJS.getDocument(file).promise; //<-- simply change it here
const pages = loadPDF.numPages;

@A-EL
Copy link

A-EL commented Oct 30, 2019

the view port error is die to using version 1 way:
var viewport = pdfPage.getViewport(scale, rotate);

change it to use GetViewportParameters :
https://github.com/mozilla/pdf.js/blob/master/src/display/api.js#L158

var viewport = pdfPage.getViewport({scale:scale, rotate:rotate});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants