Merge pull request #2700 from yurydelendik/disable-protection
Addresses https://bugzilla.mozilla.org/show_bug.cgi?id=792816#c12
This commit is contained in:
commit
7f6456d05d
@ -538,11 +538,8 @@ var PDFDocument = (function PDFDocumentClosure() {
|
||||
return shadow(this, 'numPages', num);
|
||||
},
|
||||
getDocumentInfo: function PDFDocument_getDocumentInfo() {
|
||||
var encrypt = this.xref.encrypt;
|
||||
var docInfo = {
|
||||
PDFFormatVersion: this.pdfFormatVersion,
|
||||
IsTextCopyDisabled: encrypt ? encrypt.disableTextCopy : false,
|
||||
IsPrintDisabled: encrypt ? encrypt.disablePrint : false,
|
||||
IsAcroFormPresent: !!this.acroForm
|
||||
};
|
||||
if (this.xref.trailer.has('Info')) {
|
||||
|
@ -561,8 +561,6 @@ var CipherTransformFactory = (function CipherTransformFactoryClosure() {
|
||||
var ownerPassword = stringToBytes(dict.get('O'));
|
||||
var userPassword = stringToBytes(dict.get('U'));
|
||||
var flags = dict.get('P');
|
||||
this.disableTextCopy = !(flags & 16);
|
||||
this.disablePrint = !(flags & 4);
|
||||
var revision = dict.get('R');
|
||||
var encryptMetadata = algorithm == 4 && // meaningful when V is 4
|
||||
dict.get('EncryptMetadata') !== false; // makes true as default value
|
||||
|
@ -1198,14 +1198,6 @@ canvas {
|
||||
background-color: rgba(0, 100, 0, 0.2);
|
||||
}
|
||||
|
||||
#viewerContainer.copy-protection .textLayer > div {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
#viewerContainer.copy-protection .textLayer > div > .highlight {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* TODO: file FF bug to support ::-moz-selection:window-inactive
|
||||
so we can override the opaque grey background when the window is inactive;
|
||||
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
|
||||
@ -1358,10 +1350,6 @@ canvas {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#viewerContainer.print-protection {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page {
|
||||
float: left;
|
||||
display: none;
|
||||
|
@ -1352,28 +1352,6 @@ var PDFView = {
|
||||
// AcroForm/XFA was found
|
||||
PDFView.fallback();
|
||||
}
|
||||
|
||||
if (info.IsTextCopyDisabled) {
|
||||
document.getElementById('viewerContainer').classList
|
||||
.add('copy-protection');
|
||||
} else {
|
||||
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');
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
@ -1640,9 +1618,6 @@ 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…
x
Reference in New Issue
Block a user