hi guys im using crystal report 8.5. but i wanted to print some report in the network by using some share printer.
it is possible ?
please kindly share some idea on how it take.
thx in advance.
hi guys im using crystal report 8.5. but i wanted to print some report in the network by using some share printer.
it is possible ?
please kindly share some idea on how it take.
thx in advance.
's simple idea (make the desired network printer the machine default) will work, but it is blunt and affects the whole OS. Two safer, commonly used options for Crystal Reports 8.5 from a VB app:
If the Crystal runtime being used exposes a printer-setting API, set the report's target printer directly through that API (consult the CR 8.5 runtime/SDK documentation for printer/print methods). That prevents touching the system default and is the preferred solution when available.
If the runtime lacks a direct printer property, temporarily switch the Windows default printer just for the print operation and then restore the previous default. The code example below shows a VB6-friendly pattern using WScript.Network. This approach requires the network printer to be installed/available to the account that runs the process.
' VB6: temporarily change default printer, print, then restore
Dim wsh As Object
Dim prevPrinter As String
Set wsh = CreateObject("WScript.Network")
prevPrinter = Printer.DeviceName ' save current default
On Error GoTo ErrHandler
wsh.SetDefaultPrinter "\\ServerName\PrinterShare" ' or the name shown in Printers
' --- call the app's Crystal Reports print routine here ---
' Example: Call PrintMyCrystalReport(myReport)
ErrHandler:
On Error Resume Next
wsh.SetDefaultPrinter prevPrinter ' restore original default
Set wsh = Nothing Notes and cautions: the printer must be installed for the user account that runs the process (services/IIS accounts often lack per-user printers). Changing the system default is not safe for high-concurrency or multi-user servers — restore the original value in all error paths. If adding a connection programmatically is needed, use WshNetwork.AddWindowsPrinterConnection (or install the printer on the machine) before printing. As mentioned, the CR installation/SDK often includes sample modules demonstrating printer handling; check those samples for CR-specific APIs. Exporting to PDF and sending that file to a print queue is a useful alternative on servers.
Jump to Post— bornok15 3Open up EPS drew there is an unused module to do that.. ayn
Set the computer up so its default printer is pointed to the printer you want.
Good Luck
Open up EPS drew there is an unused module to do that.. ayn
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.