简体   繁体   中英

ASP.NET Crystal Report Print Automatically

I would like to know if exists the way to send a crystal report directly to the printer without print dialog. Ex. I have an asp.net page with a crystal report viewer and I want send to print once the report have been loaded into the viewer.

I saw an application what it is doing that but I don't know how that work.

I am using

  • Visual Studios 2010
  • Crystal Report for .NET Framework (Version=13.0.2000.0)
  • C# 4

if have a code sample (will be great!!!!)

I have read lot of resources in internet but nothing give me idea how to do what I need.

Thanks in Advance.

JS

It does not working like you think. Method PrintToPrinter generates printout directly to printer. Report preview also do the same. If you are executing both methods then report is generating twice. If you have more pritnout pages then report preview generates only visible pages. In most cases this does not change anything, but if report is generating a lot of time, then you are getting a lot of resources from system and you can expect deadlock on database. You also have to remember that if your report is generating new data per each executing then you will have doubled data.

Good I did it

I Just set this values to the ReportDocument.

CrystalReportDocument.PrintOptions.PrinterName = "Printer Name"; CrystalReportDocument.PrintToPrinter(1, true, 1, 1);

anyways I am open to other ideas and suggestion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM