Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have googled this problem but no result everyone gives a solution printtoprinter() method. But it will not work on live server as my printer is not installed on server its on client PC.

I am exporting the pdf through code
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("renewal.rpt"));


rpt.SetDataSource(ds);

CrystalReportViewer1.ReportSource = rpt;

rpt.ExportToHttpResponse
(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, ind);
but on printing PDF it will made my Pagesize differ as that of my crystal report.

So i want to know that is there anyway to print crystal report directly from asp.net web page on live server? if is it so then please tell me.......
Posted
Updated 8-Jan-20 21:48pm

1 solution

Crystal report has PrintToPrinter method to print report directly to the printer.

like this

crystalReportDocument.Load("your crystal report file path");
crystalReportDocument.SetDataSource("report data source");
crystalReportDocument.PrintOptions.PrinterName = "your printer name"
crystalReportDocument.PrintToPrinter(1, true, 0, 0);
 
Share this answer
 
Comments
Richard Deeming 9-Jan-20 15:09pm    
Which will NOT work from an ASP.NET application, as the printer is connected to the client, not the server.

As the OP stated when they posted this question back in 2014...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900