[DE][PE] Show error when printing several pages

This commit is contained in:
Julia Radzhabova 2022-11-18 14:47:58 +03:00
parent 81fcfb05f0
commit 033c44d473
4 changed files with 16 additions and 8 deletions

View file

@ -89,6 +89,9 @@ define([
if (!_.isEmpty(value) && /[0-9,\-]/.test(value)) {
var res = [],
arr = value.split(',');
if (me._isPrint && arr.length>1)
return me.txtPrintRangeSingleRange;
for (var i=0; i<arr.length; i++) {
var item = arr[i];
if (!item) // empty
@ -418,7 +421,7 @@ define([
onHidePrintMenu: function () {
if (this._isPreviewVisible) {
this.api.asc_closePrintPreview && this.api.asc_closePrintPreview(this._isPrint);
this.api.asc_closePrintPreview && this.api.asc_closePrintPreview();
this._isPreviewVisible = false;
}
},
@ -500,6 +503,7 @@ define([
},
onBtnPrint: function(print) {
this._isPrint = print;
if (this.printSettings.cmbRange.getValue()===-1 && this.printSettings.inputPages.checkValidate() !== true) {
this.printSettings.inputPages.focus();
this.isInputFirstChange = true;
@ -521,12 +525,10 @@ define([
paperOrientation: size ? (size['H'] > size['W'] ? 'portrait' : 'landscape') : null
});
this._isPrint = print;
if ( print ) {
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
opts.asc_setAdvancedOptions(this.adjPrintParams);
this.api.asc_Print(opts);
this._isPrint = false;
} else {
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);
opts.asc_setAdvancedOptions(this.adjPrintParams);
@ -566,6 +568,7 @@ define([
txtCustom: 'Custom',
txtPrintRangeInvalid: 'Invalid print range',
textMarginsLast: 'Last Custom'
textMarginsLast: 'Last Custom',
txtPrintRangeSingleRange: 'Enter either a single page number or a single page range (for example, 5-12). Or you can Print to PDF.'
}, DE.Controllers.Print || {}));
});

View file

@ -957,6 +957,7 @@
"DE.Controllers.Print.txtCustom": "Custom",
"DE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range",
"DE.Controllers.Print.textMarginsLast": "Last Custom",
"DE.Controllers.Print.txtPrintRangeSingleRange": "Enter either a single page number or a single page range (for example, 5-12). Or you can Print to PDF.",
"DE.Controllers.Toolbar.confirmAddFontName": "The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the system fonts, the saved font will be used when it is available.<br>Do you want to continue?",
"DE.Controllers.Toolbar.dataUrl": "Paste a data URL",
"DE.Controllers.Toolbar.notcriticalErrorTitle": "Warning",

View file

@ -84,6 +84,9 @@ define([
if (!_.isEmpty(value) && /[0-9,\-]/.test(value)) {
var res = [],
arr = value.split(',');
if (me._isPrint && arr.length>1)
return me.txtPrintRangeSingleRange;
for (var i=0; i<arr.length; i++) {
var item = arr[i];
if (!item) // empty
@ -203,7 +206,7 @@ define([
onHidePrintMenu: function () {
if (this._isPreviewVisible) {
this.api.asc_closePrintPreview && this.api.asc_closePrintPreview(this._isPrint);
this.api.asc_closePrintPreview && this.api.asc_closePrintPreview();
this._isPreviewVisible = false;
}
},
@ -285,6 +288,7 @@ define([
},
onBtnPrint: function(print) {
this._isPrint = print;
if (this.printSettings.cmbRange.getValue()===-1 && this.printSettings.inputPages.checkValidate() !== true) {
this.printSettings.inputPages.focus();
this.isInputFirstChange = true;
@ -303,12 +307,10 @@ define([
}
});
this._isPrint = print;
if ( print ) {
var opts = new Asc.asc_CDownloadOptions(null, Common.Utils.isChrome || Common.Utils.isOpera || Common.Utils.isGecko && Common.Utils.firefoxVersion>86);
opts.asc_setAdvancedOptions(this.adjPrintParams);
this.api.asc_Print(opts);
this._isPrint = false;
} else {
var opts = new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF);
opts.asc_setAdvancedOptions(this.adjPrintParams);
@ -340,6 +342,7 @@ define([
}
},
txtPrintRangeInvalid: 'Invalid print range'
txtPrintRangeInvalid: 'Invalid print range',
txtPrintRangeSingleRange: 'Enter either a single slide number or a single slide range (for example, 5-12). Or you can Print to PDF.'
}, PE.Controllers.Print || {}));
});

View file

@ -1012,6 +1012,7 @@
"PE.Controllers.Main.textUndo": "Undo",
"PE.Controllers.Main.textContinue": "Continue",
"PE.Controllers.Print.txtPrintRangeInvalid": "Invalid print range",
"PE.Controllers.Print.txtPrintRangeSingleRange": "Enter either a single slide number or a single slide range (for example, 5-12). Or you can Print to PDF.",
"PE.Controllers.Search.notcriticalErrorTitle": "Warning",
"PE.Controllers.Search.textNoTextFound": "The data you have been searching for could not be found. Please adjust your search options.",
"PE.Controllers.Search.textReplaceSkipped": "The replacement has been made. {0} occurrences were skipped.",