Output to a printer (C#)
Set up and configure output to a printer from your reporting application.
Example - Using a server printer
This code sample uses the
Printer
class:// code snippet starts
String designFile = "OrderReport.4rp";
Printer printer = new Printer();
printer.PrinterSettings.PrinterName = "diablo";
//Configuring the print output:
printer.PrinterSettings.Duplex = System.Drawing.Printing.Duplex.Vertical;
printer.PrinterSettings.FromPage = 1;
printer.PrinterSettings.ToPage = 2;
printer.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.SomePages;
printer.DefaultPageSettings.Landscape = false;
printer.PrinterSettings.Copies = 2;
FourRpLayouter report = new FourRpLayouter(designFile, printer);
//Run the report
report.debugLevel = 9;
// some code omitted - view full source in demo
report.runFromSerializable(data);
// code snippet endsIn this example:
- A
printerobject is defined using thePrinterclass. - The
PrinterSettings.PrinterNameproperty specifies the name of the printer. - The other
PrinterSettingsproperties configure the print output in a series of calls. FourRpLayouter report = new FourRpLayouter(designFile, printer)creates the FourRpLayouter object for the specified report file that outputs to the given printer.
For the full list of properties and methods for this renderer class, refer to the Genero Report Writer .NET API documentation.