Merge pull request #5857 from Rob--W/print-page-size

Set page size via @page + size
This commit is contained in:
Tim van der Meij 2015-05-14 16:52:40 +02:00
commit d7aa95d6b1
3 changed files with 59 additions and 3 deletions

View file

@ -495,10 +495,15 @@ var PDFPageView = (function PDFPageViewClosure() {
// better output until bug 811002 is fixed in FF.
var PRINT_OUTPUT_SCALE = 2;
var canvas = document.createElement('canvas');
// The logical size of the canvas.
canvas.width = Math.floor(viewport.width) * PRINT_OUTPUT_SCALE;
canvas.height = Math.floor(viewport.height) * PRINT_OUTPUT_SCALE;
canvas.style.width = (PRINT_OUTPUT_SCALE * viewport.width) + 'pt';
canvas.style.height = (PRINT_OUTPUT_SCALE * viewport.height) + 'pt';
// The rendered size of the canvas, relative to the size of canvasWrapper.
canvas.style.width = (PRINT_OUTPUT_SCALE * 100) + '%';
canvas.style.height = (PRINT_OUTPUT_SCALE * 100) + '%';
var cssScale = 'scale(' + (1 / PRINT_OUTPUT_SCALE) + ', ' +
(1 / PRINT_OUTPUT_SCALE) + ')';
CustomStyle.setProp('transform' , canvas, cssScale);