日期:2014-05-20  浏览次数:20402 次

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

------解决方案--------------------
在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);//直接打印水晶报表

}
------解决方案--------------------
应该做不到的,呵呵。

这个本身就是由IE的安全机制决定的,你不可能做到不提示用户,就操控硬件设备。

------解决方案--------------------
水晶报表在ie中点打印默认就是直接导出

想直接打印
在水晶报表画面加个按钮

this.CrystalReportSource1.ReportDocument.PrintToPrinter(1, false, 0, 0);
------解决方案--------------------
探讨
水晶报表在ie中点打印默认就是直接导出

想直接打印
在水晶报表画面加个按钮

this.CrystalReportSource1.ReportDocument.PrintToPrinter(1, false, 0, 0);

------解决方案--------------------
不可以这样的
------解决方案--------------------
到底怎么实现,期待高手出现