PrinterName in PrinterSettings

Stimulsoft Reports.NET discussion
Post Reply
ChristianH
Posts: 43
Joined: Fri May 25, 2007 2:54 am
Location: Austria

PrinterName in PrinterSettings

Post by ChristianH »

I have to print two reports and would like to set the printer only one time.
That means the user choose the printer for the first report and the same printer will be used for the second report without another print dialog.

How can I get the PrinterName from the print dialog ?

Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

PrinterName in PrinterSettings

Post by Brendan »

Code: Select all

using(PrintDialog selectPrinter = new PrintDialog())
{
	System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
	selectPrinter.PrinterSettings = printerSettings;

	if(selectPrinter.ShowDialog() == DialogResult.OK)
	{
		//Load Report 1
		StiReport report1 = new StiReport();
		report1.Load("MyFirstReport.mrt");

		//Load Report 2
		StiReport report2 = new StiReport();
		report2.Load("MySecondReport.mrt");
		
		//Render Reports but Hide Progress Form
		report1.Render(false);
		report2.Render(false);

		//Print Reports using our Selected Printer / Settings
		report1.Print(false, printerSettings);
		report2.Print(false, printerSettings);
	}
}
ChristianH
Posts: 43
Joined: Fri May 25, 2007 2:54 am
Location: Austria

PrinterName in PrinterSettings

Post by ChristianH »

Thanks for your answer.
Meanwhile I´ve solved the problem like you suggested.

Best regards !
Post Reply