Refactor: configurable page rotation in print job
Determine the page rotation at the same place as where the page size is determined. This allows us to implement custom print page rotation logic in one place, in the future.
This commit is contained in:
parent
6f0cf8c4cb
commit
775441b7c6
@ -61,7 +61,7 @@
|
||||
var renderContext = {
|
||||
canvasContext: ctx,
|
||||
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
|
||||
viewport: pdfPage.getViewport(1),
|
||||
viewport: pdfPage.getViewport(1, size.rotation),
|
||||
intent: 'print'
|
||||
};
|
||||
return pdfPage.render(renderContext).promise;
|
||||
|
@ -60,7 +60,7 @@
|
||||
var renderContext = {
|
||||
canvasContext: ctx,
|
||||
transform: [PRINT_UNITS, 0, 0, PRINT_UNITS, 0, 0],
|
||||
viewport: pdfPage.getViewport(1),
|
||||
viewport: pdfPage.getViewport(1, size.rotation),
|
||||
intent: 'print'
|
||||
};
|
||||
return pdfPage.render(renderContext).promise;
|
||||
|
@ -949,12 +949,16 @@ var PDFViewer = (function pdfViewer() {
|
||||
|
||||
/**
|
||||
* Returns sizes of the pages.
|
||||
* @returns {Array} Array of objects with width/height fields.
|
||||
* @returns {Array} Array of objects with width/height/rotation fields.
|
||||
*/
|
||||
getPagesOverview: function () {
|
||||
return this._pages.map(function (pageView) {
|
||||
var viewport = pageView.pdfPage.getViewport(1);
|
||||
return {width: viewport.width, height: viewport.height};
|
||||
return {
|
||||
width: viewport.width,
|
||||
height: viewport.height,
|
||||
rotation: viewport.rotation,
|
||||
};
|
||||
});
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user