Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SelectPrinter not working in Crystal RDC

Status
Not open for further replies.

D1000

Technical User
Aug 16, 2002
46
0
0
US
We have a web application developed using ASP that calls a Crystal report and attempts to print it to a printer selected by the user.

The printer is defined by name and the code used is as follows (this was done using VB but the code is in an ASP application and follows the same logic):

crxApp = CreateObject("CrystalRuntime.Application")
crxReport = crxApp.OpenReport(reportName)
crxReport.MorePrintEngineErrorMessages = False
crxReport.EnableParameterPrompting = False
crxReport.DisplayProgressDialog = False
crxReport.SelectPrinter(driverName, printerName, portName)
crxReport.PaperOrientation = 0
crxReport.PrintOut(False)

We have tried this against RDC v8/8.5/9 and have noticed the following problems:

1) If the printer is a local printer, the report will only print if the printer name and model name are the same as found the in the Windows Printer applet. If we change the name of the printer to something else, then nothing happens and there are no error messages.

2) If the printer is a network printer, nothing happens. No printing or error messages.

All this works if we use a VB application to call the report and print.

Any ideas or suggestions would be welcome.
 
Perhaps you can demonstrate what you're using for the printer name rather than alluding to it.

Not sure what change the printer name to something else means here, are you changing the name in code, or do you mean on the machine hosting the printer?

-k
 
Thanks for the responses.

I have seen that KB article and it does not apply to #1 as it is a local printer. We are checking into how it is affecting printing to a network printer.

As far as the printer name is concerned, we change the name in the Windows Printer applet. For example:

Name Model
---- -----
Brother Brother HL-1660 series

If the above is set, the report does not print, but the following will work:

Name Model
---- -----
Brother HL-1660 series Brother HL-1660 series

So the code would be:

crxReport.SelectPrinter(driverName, "Brother", portName)
 
Can you get to the Printers collection in ASP, and verify with some output calls to loop through the available printers to make sure the name is correct? In VB, that would look like this:

Dim p As Printer
Debug.Print "*****************"
For Each p In Printers
Debug.Print p.DeviceName
Debug.Print p.DriverName
Debug.Print p.Port
Debug.Print "*****************"
Next

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top