Skip to content

Commit 4655ec0

Browse files
committed
Localize print message. Show/hide print button.
1 parent 7e5a9b7 commit 4655ec0

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

l10n/en-US/viewer.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@ loading_error=An error occurred while loading the PDF.
8787
# Some common types are e.g.: "Check", "Text", "Comment", "Note"
8888
text_annotation_type=[{{type}} Annotation]
8989
request_password=PDF is protected by a password:
90+
91+
printing_not_supported=Warning: Printing is not supported by this browser.

web/viewer.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,9 @@
102102
<span data-l10n-id="open_file_label">Open</span>
103103
</button>
104104

105-
<!--
106105
<button id="print" class="toolbarButton print" title="Print" tabindex="11" data-l10n-id="print" onclick="window.print()">
107106
<span data-l10n-id="print_label">Print</span>
108107
</button>
109-
-->
110108

111109
<button id="download" class="toolbarButton download" title="Download" onclick="PDFView.download();" tabindex="12" data-l10n-id="download">
112110
<span data-l10n-id="download_label">Download</span>

web/viewer.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,9 @@ var PDFView = {
10501050

10511051
beforePrint: function pdfViewSetupBeforePrint() {
10521052
if (!this.supportsPrinting) {
1053-
alert('Printing is not supported by this browser.');
1053+
var printMessage = mozL10n.get('printing_not_supported', null,
1054+
'Warning: Printing is not supported by this browser.');
1055+
alert(printMessage);
10541056
return;
10551057
}
10561058
for (var i = 0, ii = this.pages.length; i < ii; ++i) {
@@ -1761,6 +1763,10 @@ window.addEventListener('load', function webViewerLoad(evt) {
17611763
document.querySelector('#viewSearch').classList.remove('hidden');
17621764
}
17631765

1766+
if (!PDFView.supportsPrinting) {
1767+
document.getElementById('print').classList.add('hidden');
1768+
}
1769+
17641770
// Listen for warnings to trigger the fallback UI. Errors should be caught
17651771
// and call PDFView.error() so we don't need to listen for those.
17661772
PDFJS.LogManager.addLogger({

0 commit comments

Comments
 (0)