I. Overview
1. Application scenarios
The user wants to print with a fixed printer every time they print, and do not pop up a dialog box for setting. Now you can set up silent printing.
2. Function description
Silent printing, that is, when you click Print, the option window and printer setting window will not pop up, and you can print directly.
No client printing,Local printing,Server-side printingSupport silent printing.
II. Use print settings to achieve silent printing
1. No client printing setting method
Note: The no client print setting method only supports IE browser.
Click onTemplates>Print Settings,choose Indivifuallyfor the template.
CheckNo Client Printing, Check NoPrint settings in IE,As shown below:
After setting, in IE browser, clickPrint buttonYou can print silently.
2. Local printing setting method
The user sets the style to be printed in advance in the designer, inherits the paper, layout and margin settings of the template when printing, and no longer pops up the setting window to achieve silent printing.
1) Settings on the designer side
Click onTemplates>Print Settings,chooseIndivifuallyfor the template.
CheckLocal Printing, CheckShow print setting window when printing,As shown below:
Note: when uncheck Show print setting window when printingthe predefined default configuration takes precedence over the silent printing setting for local printing.
2) Browser settings
Preview the template, when you click the button to print, check itSave client settings and perform silent printing. pop upSave client settingPop-up window, selectSaveThat's it. As shown below:
After printing is completed, the next time you print, you can perform silent printing according to the saved print settings this time.
III. Realize silent printing through JS
1. No client printing JS method
Note: The no client print setting method only supports IE browser.
isPopUp : false, // Whether to pop up the setting window, true means to pop up, false means not to pop upieQuietPrint : true,// IE silent printing set true to silent, false to not silent
var printurl="http://localhost:8075/webroot/decision/view/report";
var reportlets ="[{reportlet: 'GettingStarted.cpt', Region: 'North China'}, {reportlet: 'GettingStarted.cpt',
Region: 'East China'}]";
var config = {printUrl : printurl,
isPopUp : false,
// Whether to pop up the setting window, true means pop up, false means no pop up
data :{
reportlets: reportlets // List of templates to be printed
},
printType : 0, // Print type, 0 means zero client printing, 1 means local printing
// The following are the parameters printed by the zero client, which only take effect when printType is 0
ieQuietPrint : true,// IE silent print setting: true is silent, false is not silent
};
FR.doURLPrint(config);
2. Local printing JS method
isPopUp : false, // Whether to pop up the setting window, true means pop up, false means not pop upvar printurl="http://localhost:8075/webroot/decision/view/report";
var reportlets ="[{reportlet: 'GettingStarted.cpt', Region: 'North China'}, {reportlet: 'GettingStarted.cpt',
Region: 'East China'}]";
var config = {printUrl : printurl,
isPopUp : false,
// Whether to pop up the setting window, true means pop up, false means no pop up
data :{
reportlets: reportlets // List of templates to be printed
},
printType : 1, // Print type, 0 means zero client printing, 1 means local printing
// The following are the parameters for local printing, which only take effect when printType is 1
printerName : 'Microsoft Print to PDF', // Printer name
pageType: 2, // Print page number type: 0: all pages, 1: current page, 2: specified page
pageIndex: '1-3', // Page range. Valid when pageType is 2
copy: 3, // Number of prints
};
FR.doURLPrint(config);
3. Server-side printing JS method
In FineReport 10.0, server-side printing can only be called via JS. If the parameter is passed, it will print silently.
// Silent printing
window.contentPane.printReportServer({
pageType: 2, // Print page number type: 0: all pages, 1: current page, 2: specified page
pageIndex: '1-3', // Page range. Valid when pageType is 2
printerName: "" // Specify the printer
});
For details, see: Server-side print JS