This is a migrated thread and some comments may be shown as answers.

I want to print directly from my printer named XER without previewing..

1 Answer 86 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mesut
Top achievements
Rank 1
Mesut asked on 05 Jul 2017, 12:38 PM

I have a printer named XER. How can I print directly to a printer? I'm sharing my code here.

I want to print directly from my printer named XER without previewing..

thank you for your help?

  private void reportViewer1_Load(object sender, EventArgs e)
        {
            try
            {
                var mfrm = (Frm_Giris) Application.OpenForms["Frm_Giris"];
                if (mfrm != null)
                {
                    mfrm.datacenter();
                    var rap = new Prt_AYazdir();
                    rap.a.Value = alma.ToString();
                    rap.b.Value = bal.ToString();
                    rap.c.Value = tarih.ToString();
                    rap.borc.Value = borc.ToString();
                    rap.sqlDataSource1.ConnectionString = mfrm.serveryolu;
                    var ss = "a";

                    ss = "select * from xxxx where    id='" + aid + "' order by id asc; ";
                    rap.sqlDataSource1.SelectCommand = ss;
                    var reportSourcea = new Telerik.Reporting.InstanceReportSource();
                    reportSourcea.ReportDocument = rap;
                    reportViewer1.ReportSource = reportSourcea;
                    reportViewer1.RefreshReport();
                    
                   


                }
            }

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 05 Jul 2017, 01:42 PM
Hi Mesut,

If the printer is connected to the server machine, you can use a ReportProcessor to print reports without displaying them - PrintReport Method . The printer that will be used must be specified through the PrinterSettings properties you will pass to the PrintReport method.

In case of a desktop application:
You can use the ReportProcessor.PrintReport method. You can create a test project that raises a PrintDialog in order to log the machine's valid PrinterSettings and to use them for printing the report.

In case of a web application:
If you want to print from a printer connected to the client-machine, the operation will have to be performed manually by the user. The idea is that applications running in browser have limited access to the client machine, and the user should confirm the print operation and to specify the printers available at the client machine - Print a report directly at client-side without displaying it in a Web Viewer.


I hope this helps.

Regards,
Stef
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Mesut
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or