dof你好,我们在打开报表时,画面出来就进行打印,但是第一次点击打印按钮,打印机无反应,没有执行打印,在等待一段时间,进行第二次打印时,就可以正常打印。我们认为这时有些控件还没有加载完成,这种情况如何处理。- var viewer ,viewerforprint;
- var pages;
- window.onload = function () {
- GrapeCity.ActiveReports.Viewer.OnLoad("WebViewer2", function () {
- viewerforprint = GrapeCity.ActiveReports.Viewer.Attach("WebViewer2");
- GrapeCity.ActiveReports.Viewer.OnLoad("WebViewer1", function () {
- viewer = GrapeCity.ActiveReports.Viewer.Attach("WebViewer1");
- viewer.setEventsHandler({
- OnToolClick: function (e) {
- // 用户点击【套打】按钮时触发
- if (e.Tool == "套打") {
- printreport();
- return false;
- }
- },
- OnLoadProgress: function (e) {
- if (e.State == "Completed") {
- pages = e.PageCount;
- }
- }
- });
- });
- });
- }
- // 调用套打操作
- function printreport() {
- var orient = "None";
- var scale = "None";
- var from = 1;
- var to = pages;
- var ops = viewerforprint.CreatePrintOptions();
- ops.AdjustPaperOrientation = orient;
- ops.ScalePages = scale;
- ops.ClearPageRanges();
- ops.AddPageRange(from, to);
- var State=viewerforprint.Print(ops);
- alert(State);
- var sFunCallBack = $("#funCallBack").val();
- if (sFunCallBack != "") {
- window.opener[sFunCallBack]($("#CallBackParm").val());
- }
- }
复制代码 |