Print Report directly to Printer

danishce

Member
Joined
Apr 2, 2007
Messages
15
Programming Experience
3-5
I am using vb.net v1.1 and crystal report v9. I want to print the report directly to the printer without showing the report in the crystal report viewer. How can i achieve this?

CrystalReportViewer1.ReportSource= System.Environment.CurrentDirectory & "\MiniStatement.rpt"
CrystalReportViewer1.Show()
CrystalReportViewer1.PrintReport()

Thanks:
Danish Majid
 
I want to print the report using the vb.net application but without showing the report.

CrystalReportViewer1.ReportSource= System.Environment.CurrentDirectory & "\MiniStatement.rpt"
CrystalReportViewer1.Show()
CrystalReportViewer1.PrintReport()

In the above code first the report load and then it asks to select the printer then it starts printing but i want to print this report in the printer directly without asking anthing.
 
Code for using a Print Dialog

VB.NET:
Dim MyReport As New YourReportName
MyReport.PrintOptions.PrinterName = PrintDialog1.PrinterSettings.PrinterName
MyReport.PrintToPrinter(PrintDialog1.PrinterSettings.Copies, True, 1, 99)


If you know the printer, you can force it to a specific printer...

VB.NET:
MyReport.PrintOptions.PrinterName = "\\SHIPPINGSYS\Label Printer"
MyReport.PrintOptions.PaperOrientation = CrystalDecisions.[Shared].PaperOrientation.Portrait
MyReport.PrintToPrinter(1, True, 1, 99)

Hope that helps...
 
Back
Top