Set PrinterSettings before Print Preview (report.Show(true))

Stimulsoft Reports.NET discussion
Post Reply
OlafD
Posts: 6
Joined: Tue Jan 04, 2011 4:17 am

Set PrinterSettings before Print Preview (report.Show(true))

Post by OlafD »

Hi there,

is there any way to set the PrinterSettings before print to Preview wth report.Show(true)) like the report.Print(printerSettings)?

Thanks

Olaf
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Set PrinterSettings before Print Preview (report.Show(tr

Post by HighAley »

Hello.

Some printer settings could be changed in the report.PrinterSettings property.

Thank you.
OlafD
Posts: 6
Joined: Tue Jan 04, 2011 4:17 am

Re: Set PrinterSettings before Print Preview (report.Show(tr

Post by OlafD »

Hello,

i know this, but you can change only the Copies an the Printer Name.
Wahts about the PaperSource etc. etc.

Whats about :
PrinterSettings printerSettings = new ....
report.Show(true, printerSettings ))
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Set PrinterSettings before Print Preview (report.Show(tr

Post by HighAley »

Hello.

You could handle the Stimulsoft.Report.StiOptions.Engine.GlobalEvents.ReportPrinting event to change report settings.

Thank you.
OlafD
Posts: 6
Joined: Tue Jan 04, 2011 4:17 am

Re: Set PrinterSettings before Print Preview (report.Show(tr

Post by OlafD »

Do you have a sample source code to set the PrinterSettimg by a PrinterSettings Object or the PaperSource
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Set PrinterSettings before Print Preview (report.Show(tr

Post by HighAley »

Hello.

We need some time to prepare an answer for you.

Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Set PrinterSettings before Print Preview (report.Show(tr

Post by HighAley »

Hello.

Please, read an article in our Knowledge Base
Thank you.
OlafD
Posts: 6
Joined: Tue Jan 04, 2011 4:17 am

Re: Set PrinterSettings before Print Preview (report.Show(tr

Post by OlafD »

i ask for a sample to set the PrinterSetting by a PrinterSettings Object, not for "How to enable the editor-mode from code".
Thank you.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Set PrinterSettings before Print Preview (report.Show(tr

Post by HighAley »

Hello.

Sorry, it was our mistake. You should use the PrintingDocumentInViewer global event.

The code to handle it:

Code: Select all

StiOptions.Engine.GlobalEvents.PrintingDocumentInViewer += new EventHandler(GlobalEvents_PrintingDocumentInViewer);
report.Show(true);
...............

void GlobalEvents_PrintingDocumentInViewer(object sender, EventArgs e)
{
    PrinterSettings ps = new PrinterSettings();
    ps.Copies = 2;
    ps.PrinterName = "Fax";
    ((StiReport)sender).Print(ps);
}
Thank you.
Post Reply