0
votes

We are migrating a legacy windows form app built using Visual Basic 6 into .net framework 3/3.5 using Visual Studio 2008 as part of an ongoing requirement. There is a requirement : Get the list of printers. The printers exist in remote locations on the network. if a user selects a printer the system should be able to print the crystal report to that particular printer. I am using crystal report viewer to preview a report but as soon as I invoke the report in crystal report viewer the report should also be sent off to that printer chosen in the drop down list of printers on the network. How will I be able to print to a remote printer on the network? I am using c# and vs 2008 to achieve this as part of the req.

1

1 Answers

0
votes

What I've done is:

  • Manually manage a list of network printer names (\server\printer1, \server\printer2, etc) via database lookup, XML file, or whatever.
  • On the client page, render a dropdown for the printers and add a "Print" button.
  • Directly under those controls, render a Crystal Viewer without the standard Print/Export options.
  • When the client submits the form/page, do server-side printing based on the dropdown printer ID.

You have 2 options for server-side printing of using the free Crystal runtime that runs under IIS.

  1. The old, deprecated way: reportDocument.PrintToPrinter({printer settings}, {page settings}, {reformat}). You pass the printer name in the {printer settings}.

  2. The preferred way: printOutputController.PrintReport({print options})

Note: The printer name is case-sensitive in method 2, and it must be installed so that it shows up in System.Drawing.PrinterSettings.InstalledPrinters() for the user running the .NET process.