Page 1 of 1

How to set no default printer?

Posted: Mon Sep 24, 2012 9:23 am
by Jennypi
Hi,

My users use Stimulsoft through a Citrix environment. Because they use multiple printers, and in order to force them to choose the right printer (mistakes occur daily and cause waste of paper/labels), I would like to set the printer field as empty when they click on the Print button.
print.JPG
print.JPG (24.48 KiB) Viewed 2172 times
I have no idea how to do that. I don't code, I only use the designer.
Can you help me with having (coding?) this?
Would I have to edit all reports one by one, or is there a kind of configuration file that could do the job for all?

Many thanks!

Re: How to set no default printer?

Posted: Mon Sep 24, 2012 2:59 pm
by Jennypi
Hi again,

I've found some code examples to set a default printer in the developer manual, but I can't find where to paste them.
When I open my report's Code tab, I see the code below:

Code: Select all

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.ReportControls;
using Stimulsoft.Report.Components;
namespace Reports
{
        public class Report : Stimulsoft.Report.StiReport
    {
                public Report()
        {
            this.InitializeComponent();
        }
        #region StiReport Designer generated code - do not modify#endregion StiReport Designer generated code - do not modify
    }
}
Where should I paste my additional code? And should I make any change so it works with my report?
I tried to paste it after this.InitializeComponent(); but got errors.

Code: Select all

			//Create Printer Settings
			PrinterSettings printerSettings = new PrinterSettings();
			//Set Printer to Use for Printing
			printerSettings.PrinterName = "myprinter'sname";

Re: How to set no default printer?

Posted: Tue Sep 25, 2012 9:21 am
by HighAley
Hello.

Please, try to use next code:

Code: Select all

this.InitializeComponent();
this.PrinterSettings.PrinterName = "myprinter'sname";
Thank you.

Re: How to set no default printer?

Posted: Tue Sep 25, 2012 12:39 pm
by Jennypi
Works like a charm :)

Thanks a lot!

Re: How to set no default printer?

Posted: Tue Sep 25, 2012 12:49 pm
by Alex K.
Hello,

We are always glad to help you!
Let us know if you need any additional help.