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

Direct Client Side Printing - Error

1 Answer 109 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Krishna
Top achievements
Rank 1
Krishna asked on 24 Mar 2016, 12:14 PM

Hi

Im using the following code to print report viewer directly to the printer from client side.

 

In ASPX

<div style="display:none">
            <telerik:ReportViewer ID="ReportViewer1" runat="server" Height="105px" Width="693px">
            </telerik:ReportViewer>
</div> 

In ASPX.cs, on button click

Report1 report = new Report1();
string selectCommand = @"select EmployeeID,EmployeeName from master_employee";
string connectionString = "Data Source=STATIONXXX;Initial Catalog=abc;User Id=sa;Password=123";
Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource(connectionString, selectCommand);
report.DataSource = sqlDataSource;

ReportViewer1.Report = report;
string PrintScript = string.Format("{0}.PrintReport()", this.ReportViewer1.ClientID);
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Print", PrintScript, true);

 

 

But when i press print button i'm getting the following error

 

"Error printing the report: TypeError:toolbar.GetButtonByName is not a function"

 

Im using google chrome as browser.

 

Can any one help me on this?

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 25 Mar 2016, 12:32 PM
Hello Krishna,

In general, applications running in browser does not have access to the client machine.

The existing web viewers use the True Print functionality to print at the client. The approach we use is to export in PDF with additional Adobe Javascript that causes PDF reader's to open their print dialog. The PDF file is returned to the browser and the browser's Adobe PDF plugin handles the document further.
The full scenario is illustrated in Print a report directly at client-side without displaying it in an ASP.NET ReportViewer the code library post.
In this scenario, avoiding the user's confirmation may not be possible due to security restrictions.

Instead you can print from a printer machine connected to the server - ReportProcessore.PrintReport method, which allows you to send a document to be printed silently.


I hope this information is helpful.

Regards,
Stef
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
Krishna
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or