Skip to content

Commit

Permalink
Merge pull request mozilla#2700 from yurydelendik/disable-protection
Browse files Browse the repository at this point in the history
  • Loading branch information
mduan committed Feb 8, 2013
2 parents 74c3508 + 6ce1cfe commit 7f6456d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 42 deletions.
3 changes: 0 additions & 3 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
2 changes: 0 additions & 2 deletions src/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 0 additions & 12 deletions web/viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -1358,10 +1350,6 @@ canvas {
margin: 0;
}

#viewerContainer.print-protection {
display: none;
}

.page {
float: left;
display: none;
Expand Down
25 changes: 0 additions & 25 deletions web/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
});
},

Expand Down Expand Up @@ -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.');
Expand Down

0 comments on commit 7f6456d

Please sign in to comment.