开发工具是VS2003.
asp.net的web程序
用水晶报表导出成PDF后,可以在IE中浏览。
现在想直接打印该PDF(就是用户不需要点击“打印”按钮)。
请问该怎么做?

解决方案 »

  1.   

    在Page_Load里面加载水晶报表的时候,把水晶报表打印就行了撒,其实你的pdf文件也是从水晶报表中导出来的,打印水晶报表和打印pdf文件的效果是一回事撒。
        ReportDocument ReportDoc=new ReportDocument(); 
        protected void Page_Load(object sender, EventArgs e)
        {
            ReportDoc.Load(Server.MapPath("CrystalReport1.rpt"));
            string conn = ConfigurationManager.ConnectionStrings["NorthwindConnectionString1"].ConnectionString;
            SqlConnection scc = new SqlConnection(conn);
            scc.Open();
            string sql = "select * from employees where employeeID='1'";
            SqlDataAdapter da = new SqlDataAdapter(sql, conn);
            DataSet1 ds = new DataSet1();
            da.Fill(ds, "employees");
            ReportDoc.SetDataSource(ds);
            CrystalReportViewer1.ReportSource = ReportDoc;
            ReportDoc.PrintToPrinter(1, true, 1, 1);//直接打印水晶报表    }
      

  2.   

    5楼的可以,不过要记得把水晶报表设置为ActiveX方式,不然在服务器上打
      

  3.   


    不行的,vs2003中的报表根本没有printmode 属性。
      

  4.   

    水晶报表在ie中点打印默认就是直接导出想直接打印
    在水晶报表画面加个按钮  this.CrystalReportSource1.ReportDocument.PrintToPrinter(1, false, 0, 0);