Browse Source

Localize print message. Show/hide print button.

Brendan Dahl 13 years ago
parent
commit
4655ec0c75
  1. 2
      l10n/en-US/viewer.properties
  2. 2
      web/viewer.html
  3. 8
      web/viewer.js

2
l10n/en-US/viewer.properties

@ -87,3 +87,5 @@ loading_error=An error occurred while loading the PDF.
# Some common types are e.g.: "Check", "Text", "Comment", "Note" # Some common types are e.g.: "Check", "Text", "Comment", "Note"
text_annotation_type=[{{type}} Annotation] text_annotation_type=[{{type}} Annotation]
request_password=PDF is protected by a password: request_password=PDF is protected by a password:
printing_not_supported=Warning: Printing is not supported by this browser.

2
web/viewer.html

@ -102,11 +102,9 @@
<span data-l10n-id="open_file_label">Open</span> <span data-l10n-id="open_file_label">Open</span>
</button> </button>
<!--
<button id="print" class="toolbarButton print" title="Print" tabindex="11" data-l10n-id="print" onclick="window.print()"> <button id="print" class="toolbarButton print" title="Print" tabindex="11" data-l10n-id="print" onclick="window.print()">
<span data-l10n-id="print_label">Print</span> <span data-l10n-id="print_label">Print</span>
</button> </button>
-->
<button id="download" class="toolbarButton download" title="Download" onclick="PDFView.download();" tabindex="12" data-l10n-id="download"> <button id="download" class="toolbarButton download" title="Download" onclick="PDFView.download();" tabindex="12" data-l10n-id="download">
<span data-l10n-id="download_label">Download</span> <span data-l10n-id="download_label">Download</span>

8
web/viewer.js

@ -1050,7 +1050,9 @@ var PDFView = {
beforePrint: function pdfViewSetupBeforePrint() { beforePrint: function pdfViewSetupBeforePrint() {
if (!this.supportsPrinting) { if (!this.supportsPrinting) {
alert('Printing is not supported by this browser.'); var printMessage = mozL10n.get('printing_not_supported', null,
'Warning: Printing is not supported by this browser.');
alert(printMessage);
return; return;
} }
for (var i = 0, ii = this.pages.length; i < ii; ++i) { for (var i = 0, ii = this.pages.length; i < ii; ++i) {
@ -1761,6 +1763,10 @@ window.addEventListener('load', function webViewerLoad(evt) {
document.querySelector('#viewSearch').classList.remove('hidden'); document.querySelector('#viewSearch').classList.remove('hidden');
} }
if (!PDFView.supportsPrinting) {
document.getElementById('print').classList.add('hidden');
}
// Listen for warnings to trigger the fallback UI. Errors should be caught // Listen for warnings to trigger the fallback UI. Errors should be caught
// and call PDFView.error() so we don't need to listen for those. // and call PDFView.error() so we don't need to listen for those.
PDFJS.LogManager.addLogger({ PDFJS.LogManager.addLogger({

Loading…
Cancel
Save