1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Implements the print permission

This commit is contained in:
vyv03354 2013-02-08 23:23:01 +09:00
parent 51c81a1d01
commit 729b82359a
4 changed files with 23 additions and 0 deletions

View file

@ -1358,6 +1358,10 @@ canvas {
margin: 0;
}
#viewerContainer.print-protection {
display: none;
}
.page {
float: left;
display: none;

View file

@ -1360,6 +1360,20 @@ var PDFView = {
document.getElementById('viewerContainer').classList
.remove('copy-protection');
}
if (info.IsPrintDisabled) {
if (PDFView.supportsPrinting) {
document.getElementById('print').classList.add('hidden');
}
document.getElementById('viewerContainer').classList
.add('print-protection');
} else {
if (PDFView.supportsPrinting) {
document.getElementById('print').classList.remove('hidden');
}
document.getElementById('viewerContainer').classList
.remove('print-protection');
}
});
},
@ -1626,6 +1640,9 @@ var PDFView = {
},
beforePrint: function pdfViewSetupBeforePrint() {
if (this.documentInfo.IsPrintDisabled) {
return;
}
if (!this.supportsPrinting) {
var printMessage = mozL10n.get('printing_not_supported', null,
'Warning: Printing is not fully supported by this browser.');