locked
Crystal Report display perfectly but not print using button click event on IIS 6.0 RRS feed

  • Question

  • User1570325501 posted

    I'm currently using Visual Studio 2010(4.0) ,Crystal Reports Developer 13.0.2 and my OS windows 7 Ultimate 64 bit.

    now i add install printer on DropDownList and add Button for Print Crystal report using printtoprinter(noofcopy, true, startno, endno).

    it work on developer machine fine but not work print on IIS 6.0. i can view crystal report perfectly on IIS 6.0.

    i want to print crystal report on IIS when button click event. i try every thing for print crystal report on IIS but still not print.

    if any suggestion please give me reply..

    thank in advance..

    Monday, July 7, 2014 4:04 AM

All replies

  • User-25924017 posted

    May be you already checked but 

    On the server (where your IIS is), is their any printer installed and marked as default? 

    Monday, July 7, 2014 4:15 AM
  • User1570325501 posted

    my developer machine and IIS host machine both are same and local it work perfect but it's  not work on IIS.

    I add printer list on DropDownList it code below.

    if (!IsPostBack)
    {
            foreach (String printer in PrinterSettings.InstalledPrinters)
            {
                    ddl_printers.Items.Add(printer.ToString());
            }
    }

    And use Button Click Event for print Crystal Report it code below

    protected void btn_print_Click(object sender, EventArgs e)
    {

              string PrinterName = ddl_printers.SelectedItem.Text;
              //string SystemName = "\\\\SMARTAPPS-PC1\\";

              //Get the Copy times
             int nCopy = Check_Integer(txt_no_of_copy.Text);
             //Get the number of Start Page
             int sPage = Check_Integer(txt_from_page.Text);
             //Get the number of End Page
             int ePage = Check_Integer(txt_to_page.Text);

             //CrystalDecisions.Shared.PageMargins edges = new CrystalDecisions.Shared.PageMargins(1, 1, 1, 1);
             //CrystalDecisions.Shared.PaperSize ps = new CrystalDecisions.Shared.PaperOrientation.

             CustomerReport.PrintOptions.PrinterName = PrinterName; //"\\\\192.168.1.102\\" +

            //CustomerReport.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
            //CustomerReport.PrintOptions.PaperSize = PaperSize.PaperA4;
           //CustomerReport.PrintOptions.PaperOrientation =
           CustomerReport.PrintToPrinter(1, true, 0, 0);

          //CustomerReport.PrintOptions.PrinterName = PrinterName;
          //CustomerReport.PrintToPrinter(1, false, 0, 0);

    }

    i try everything (change registry, change printer mode = Active x, change ReportDocument.PrintOptions.PrinterName=PrinterName;

    but i can't get any solution for printtoprinter on IIS 6.0

    if any one face this problem and solve or know solution please help me. i spend 10 day to find print crystal report on IIS but no result.

    thanks in advance.

    Monday, July 7, 2014 6:43 AM
  • User-1454326058 posted

    Hi darji_nitish,

    In my opinion, it can’t print crystal report if the application is host in the IIS. The reason of it could works fine when you run the application through VS is that the application that run from the VS directly has the enough permission and it runt the application as client. However, when the application in the local IIS, it couldn’t call client application.

    I think you need use the JavaScript to achieve that. (E.g. window.print())

    Thanks

    Best Regards

    Tuesday, July 8, 2014 2:18 AM
  • User1570325501 posted

    thanks for your reply 

    I think crystal report should work on IIS. my crystal report open on IIS perfectly, Export to PDF and other All Export function work perfectly but my Crystal Report not print on printer.
    I know on my developing machine user have All Permissions for Printing and not to IIS user.

    If any one face this problem and solve it please reply me suggestion.
    thanks in advance.

    Tuesday, July 8, 2014 8:58 AM
  • User-1454326058 posted

    Hi darji_nitish,

    my crystal report open on IIS perfectly, Export to PDF and other All Export function work perfectly

    In my opinion, that different to the print. To print the report, it needs to call client software.

    For the permission issue, you could implement impersonation, more information, please refer to:

    # How to implement impersonation in an ASP.NET application

    http://support.microsoft.com/kb/306158/en-us

    After that it will have the enough permission, if the print function still doesn’t work, that means it is impossible to do that. Please use the JavaScript to achieve that.

    Thanks

    Best Regards

    Tuesday, July 8, 2014 10:52 PM