[api-minor] Change the getViewport method, on PDFPageProxy, to take a parameter object rather than a bunch of (randomly) ordered parameters

If, as PR 10368 suggests, more parameters should be added to `getViewport` I think that it would be a mistake to not change the signature *first* to avoid needlessly unwieldy call-sites.

To not break any existing code and third-party use-cases, this is obviously implemented with a deprecation warning *and* with a working fallback[1] for the old method signature.

---
[1] This is limited to `GENERIC` builds, which should be sufficient.
This commit is contained in:
Jonas Jenwald 2018-12-21 11:47:37 +01:00
parent ba2edeae18
commit f0719ed565
19 changed files with 54 additions and 38 deletions

View file

@ -61,7 +61,7 @@ describe('custom canvas rendering', function() {
if (isNodeJS()) {
pending('TODO: Support Canvas testing in Node.js.');
}
var viewport = page.getViewport(1);
var viewport = page.getViewport({ scale: 1, });
var canvasAndCtx = CanvasFactory.create(viewport.width, viewport.height);
const renderTask = page.render({
@ -80,7 +80,7 @@ describe('custom canvas rendering', function() {
if (isNodeJS()) {
pending('TODO: Support Canvas testing in Node.js.');
}
var viewport = page.getViewport(1);
var viewport = page.getViewport({ scale: 1, });
var canvasAndCtx = CanvasFactory.create(viewport.width, viewport.height);
const renderTask = page.render({