Cyrstal Report Document PrintToPrinter

Last post 12-02-2009 5:16 AM by swagat1986. 5 replies.

Sort Posts:

  • Cyrstal Report Document PrintToPrinter

    11-30-2009, 11:05 PM
    • Contributor
      2,778 point Contributor
    • sivakl_2001
    • Member since 01-11-2008, 8:13 AM
    • Kuala Lumpur, Phileo Damansara
    • Posts 804

    hi i need to print crystalreport directly without showing anything to user

    is it possible

    i try this but i got error

     

    cryRpt.Load(Server.MapPath(

    cryRpt.SetDataSource(ReportSet)

     

     

     

     

     

    Dim cryRpt As New ReportDocument

    cryRpt.Load(Server.MapPath("PrintableReport.rpt"))

     

     

    Dim pdoc As New System.Drawing.Printing.PrintDocument

    Dim strDefaultPrinter As String = pdoc.PrinterSettings.PrinterName

    cryRpt.PrintOptions.PrinterName = strDefaultPrinter

    cryRpt.PrintToPrinter(1,False, 0, 0)

     

    i got the follwing Error

    Win32Excaption has unhandled by user Code

    "Operation Completed Successfully"

     

     

     

  • Re: Cyrstal Report Document PrintToPrinter

    12-01-2009, 1:15 AM
    Answer
    • Participant
      1,480 point Participant
    • bloggernext
    • Member since 07-13-2009, 3:21 AM
    • Posts 264

    try this out
    Create an instance of ReportDocument and
    ReportDocument.Load("*.rpt")
    ReportDocument.PrintToPrinter
    It may resolve your problem
    if not try this article might help you out
    http://aspalliance.com/509_Automatically_Printing_Crystal_Reports_in_ASPNET.all

    When an Italian tells me its pasta on the plate I check under the sauce to make sure. They are the inventors of the smokescreen.-Sir Alex Ferguson
    Please Mark as Answer if it helps.
  • Re: Cyrstal Report Document PrintToPrinter

    12-01-2009, 1:46 AM
    • Member
      402 point Member
    • Rakeshkr
    • Member since 10-09-2009, 10:55 AM
    • Bangalore
    • Posts 82

     ////bind the dropdownlist for available printer
            //DropDownList1.DataSource = System.Drawing.Printing.PrinterSettings.InstalledPrinters;
            //DropDownList1.DataBind();

     //bind the dropdownlist for available printer At Page Load

     DropDownList1.DataSource = System.Drawing.Printing.PrinterSettings.InstalledPrinters;

     DropDownList1.DataBind();

    //  on button click select printer name from dropdownlist 

      ReportDocument myReportDocument= new ReportDocument();

       myReportDocument.Load(Server.MapPath(@"~\myReport.rpt"));

      myReportDocument.SetDataSource(ds);

       myReportDocument.PrintOptions.PrinterName = DropDownList1.SelectedValue.ToString();

       myReportDocument.PrintToPrinter(1, false, 1, 1);

     


  • Re: Cyrstal Report Document PrintToPrinter

    12-02-2009, 2:01 AM
    • Contributor
      2,778 point Contributor
    • sivakl_2001
    • Member since 01-11-2008, 8:13 AM
    • Kuala Lumpur, Phileo Damansara
    • Posts 804

    hi i didn't insall printers in my computer so

    "Microsoft Office Document Image Writer" this is my pc default printer

    i tried like this but i got the same error

     

    ReportDocument myReportDocument= new ReportDocument();

       myReportDocument.Load(Server.MapPath(@"~\myReport.rpt"));

      myReportDocument.SetDataSource(ds);

       myReportDocument.PrintOptions.PrinterName = "Microsoft Office Document Image Writer";

       myReportDocument.PrintToPrinter(1, false, 1, 1);

     

  • Re: Cyrstal Report Document PrintToPrinter

    12-02-2009, 5:10 AM
    Answer
    • Member
      402 point Member
    • Rakeshkr
    • Member since 10-09-2009, 10:55 AM
    • Bangalore
    • Posts 82

    hi,

    install printer in your system(or you can check from network) and check still you are getting error 

    or not


  • Re: Cyrstal Report Document PrintToPrinter

    12-02-2009, 5:16 AM
    • Member
      418 point Member
    • swagat1986
    • Member since 12-01-2009, 5:50 AM
    • mumbai
    • Posts 92

    Try this using javascript

    <script language=javascript>
    function CallPrint(strid)
    {
     var prtContent = document.getElementById(strid);
     var WinPrint =
    window.open('','','letf=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,sta­tus=0');
     WinPrint.document.write(prtContent.innerHTML);
     WinPrint.document.close();
     WinPrint.focus();
     WinPrint.print();
     WinPrint.close();
     prtContent.innerHTML=strOldOne;

    }

    </script>

    <div id="divPrint">

    << your crystal report data>> 
    .....
    .....
    .....

    </div>
    <asp:button ID="btnPrint" onClick="javascript:CallPrint('divPrint');"
    Runat=Server />  

    Thanks & Regards
    Swagat A. Raorane.


    Please if this answer help you remember to click "Mark as Answer".
Page 1 of 1 (6 items)