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

J

John Smith

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("ConnString"), 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top