Print with Crystal Report on Asp.net

Francesco 1 Reputation point
2021-02-22T15:29:41.977+00:00

Hi, I have this simple code in an Asp.net page, in c #:

            ReportDocument rprt = new ReportDocument();
            rprt.Load("myreport.rpt");
            rprt.PrintToPrinter(1, false, 0, 0);

But it doesn't print, it doesn't give any errors, nothing happens. Why?

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,410 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,628 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. XuDong Peng-MSFT 10,341 Reputation points Microsoft Vendor
    2021-02-23T06:34:00.703+00:00

    Hi @Francesco ,

    According to the simple code you provided, I'm not sure how you want to print it, on the server side or on the client page?

    If it is on the server side, I am not sure if you have related settings for PrintOptions, such as specifying the printer name. If you are using the default printer, is the printer properly connected to the machine?

    You could also refer to this article for more details: Troubleshooting issues related to PrintToPrinter() when used in .NET applications for printing Crystal Reports

    But if you want to print on the client page, I think this is not possible. Because the pritning functionality of Crystal which is based on ActiveX cannot be used or is not supported by the client browser. You could use the print feature in right-click of mouse in client page.

    Best regards,
    Xudong Peng


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments