Localize print message. Show/hide print button.

This commit is contained in:
Brendan Dahl 2012-07-09 16:04:55 -07:00
parent 7e5a9b7a39
commit 4655ec0c75
3 changed files with 9 additions and 3 deletions

View File

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

View File

@ -102,11 +102,9 @@
<span data-l10n-id="open_file_label">Open</span>
</button>
<!--
<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>
</button>
-->
<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>

View File

@ -1050,7 +1050,9 @@ var PDFView = {
beforePrint: function pdfViewSetupBeforePrint() {
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;
}
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');
}
if (!PDFView.supportsPrinting) {
document.getElementById('print').classList.add('hidden');
}
// 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.
PDFJS.LogManager.addLogger({