Page 1 of 1
PrinterName in PrinterSettings
Posted: Wed Sep 26, 2007 7:53 am
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 ?
PrinterName in PrinterSettings
Posted: Wed Sep 26, 2007 9:04 am
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);
}
}
PrinterName in PrinterSettings
Posted: Thu Sep 27, 2007 4:13 am
by ChristianH
Thanks for your answer.
Meanwhile I´ve solved the problem like you suggested.
Best regards !