Direct Client Side Printing - Error

2 posts, 0 answers
  1. Krishna
    Krishna avatar
    2 posts
    Member since:
    Mar 2016

    Posted 24 Mar 2016 Link to this post


    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">

    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?

  2. Stef
    Stef avatar
    3611 posts

    Posted 25 Mar 2016 Link to this post

    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.

    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
Back to Top