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:
parent
51c81a1d01
commit
729b82359a
4 changed files with 23 additions and 0 deletions
|
@ -1358,6 +1358,10 @@ canvas {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
#viewerContainer.print-protection {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page {
|
||||
float: left;
|
||||
display: none;
|
||||
|
|
|
@ -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.');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue