By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,105 Members | 2,620 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,105 IT Pros & Developers. It's quick & easy.

Sending Crystal Report to Network Print Mailbox While Bypassing Crystal Report Viewer.

P: n/a
Hello, I am developing a VB.NET 2003 application that will use lots of
Crystal Reports. Sometimes the users will preview a report in a
Crystal report viewer, and sometimes they will send the report directly
to the printer bypassing the Crystal report viewer altogether.

When sending the job directly to the printer I use the PrintToPrinter
command

CR.PrintToPrinter(1, False, 0, 0)

This works fine when printing right away those reports.

My biggest problem right now is that sometimes the users won't need
to print the report right away and will they send it to the network
printer mailboxes and stored it there until they're ready to print the
reports.

What I need is to show the Print Dialog so they can choose the network
printer (Canon ImageRunner 8500) and then the mailbox number in which
to store the report.

I am aware that the main reason of using the PrintToPrinter option is
to stop any print popup screen from showing and print and be done.
However, I do need to show the print dialog so they can have the
ability to either print right away or store the report.

If the report is previewed first and need to be stored in a printer
mailbox right after, it can be done by clicking the print icon from the
Crystal Report Viewer toolbar. The print dialog does show and work.

Can anyone help me with this?

This is a slimmed version of the code of my Print/Preview button. I
have to add report parameters, headers, signatures, etc., but that's
working perfectly, so I did not pasted it here.

'Declare variables
Dim ConnString, Prntr As String
ConnString =
CType(ConfigurationSettings.AppSettings("ConnStrin g"), String)
Prntr = CType(ConfigurationSettings.AppSettings("PrntrName "),
String)
Dim cnn01 As New SqlClient.SqlConnection(ConnString)

'set the report path
Dim RptPath As String
RptPath = FldLocation & RptToPrint

' create a new temporary copy of the selected report
Dim CR As New ReportDocument
Dim crSection As Section
Dim crReportObject As ReportObject
CR.Load(RptPath, OpenReportMethod.OpenReportByTempCopy)
' Either print or preview the report
Select Case PrintDoc
Case "Prnt"

' Check whether to print in landscape or not
Select Case Lndscp
Case True
' Set report to print in landscape
CR.PrintOptions.PaperOrientation =
CrystalDecisions.[Shared].PaperOrientation.Landscape
End Select
' get the printer name from which to print the report
'CR.PrintOptions.PrinterName = Prntr
' print the report
CR.PrintToPrinter(1, False, 0, 0)
Case "Prv"
' Preview the report in the Crystal Report Viewer
CRViewer1.ReportSource = CR
End Select

Thanks for taking your time and see if you can provide any help.

Jan 17 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.