Merge pull request #7005 from tobytailor/master

Fixes insertion of blank pages during print if page sizes differ
This commit is contained in:
Tim van der Meij 2016-03-24 14:38:27 +01:00
commit da8e345d14
3 changed files with 6 additions and 7 deletions

View File

@ -532,7 +532,6 @@ var PDFPageView = (function PDFPageViewClosure() {
// The rendered size of the canvas, relative to the size of canvasWrapper. // The rendered size of the canvas, relative to the size of canvasWrapper.
canvas.style.width = (PRINT_OUTPUT_SCALE * 100) + '%'; canvas.style.width = (PRINT_OUTPUT_SCALE * 100) + '%';
canvas.style.height = (PRINT_OUTPUT_SCALE * 100) + '%';
var cssScale = 'scale(' + (1 / PRINT_OUTPUT_SCALE) + ', ' + var cssScale = 'scale(' + (1 / PRINT_OUTPUT_SCALE) + ', ' +
(1 / PRINT_OUTPUT_SCALE) + ')'; (1 / PRINT_OUTPUT_SCALE) + ')';
@ -541,8 +540,6 @@ var PDFPageView = (function PDFPageViewClosure() {
var printContainer = document.getElementById('printContainer'); var printContainer = document.getElementById('printContainer');
var canvasWrapper = document.createElement('div'); var canvasWrapper = document.createElement('div');
canvasWrapper.style.width = viewport.width + 'pt';
canvasWrapper.style.height = viewport.height + 'pt';
canvasWrapper.appendChild(canvas); canvasWrapper.appendChild(canvas);
printContainer.appendChild(canvasWrapper); printContainer.appendChild(canvasWrapper);

View File

@ -22,12 +22,14 @@
html { html {
height: 100%; height: 100%;
width: 100%;
/* Font size is needed to make the activity bar the correct size. */ /* Font size is needed to make the activity bar the correct size. */
font-size: 10px; font-size: 10px;
} }
body { body {
height: 100%; height: 100%;
width: 100%;
background-color: #404040; background-color: #404040;
background-image: url(images/texture.png); background-image: url(images/texture.png);
} }
@ -1800,11 +1802,15 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * {
body[data-mozPrintCallback] #printContainer { body[data-mozPrintCallback] #printContainer {
display: block; display: block;
} }
#printContainer {
height: 100%;
}
/* wrapper around (scaled) print canvas elements */ /* wrapper around (scaled) print canvas elements */
#printContainer > div { #printContainer > div {
position: relative; position: relative;
top: 0; top: 0;
left: 0; left: 0;
height: 100%;
overflow: hidden; overflow: hidden;
} }
#printContainer canvas { #printContainer canvas {

View File

@ -1166,10 +1166,6 @@ var PDFViewerApplication = {
// Firefox incorrectly reports support for the other value. // Firefox incorrectly reports support for the other value.
'@supports ((size:A4) and (size:1pt 1pt)) {' + '@supports ((size:A4) and (size:1pt 1pt)) {' +
'@page { size: ' + pageSize.width + 'pt ' + pageSize.height + 'pt;}' + '@page { size: ' + pageSize.width + 'pt ' + pageSize.height + 'pt;}' +
// The canvas and each ancestor node must have a height of 100% to make
// sure that each canvas is printed on exactly one page.
'#printContainer {height:100%}' +
'#printContainer > div {width:100% !important;height:100% !important;}' +
'}'; '}';
body.appendChild(this.pageStyleSheet); body.appendChild(this.pageStyleSheet);