CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23
  1. #16
    Join Date
    Sep 2004
    Posts
    1

    Re: Printing Crystal report thro' ASp.Net

    I have tried all the possible solutions to this problem that were listed in the posts previews to this one and It simply doesnt work.

    I have changed the Machine.cfg and made all the changes to the registry and It still doesnt work.

    The code is very simple:

    crystalReport.PrintOptions.PrinterName = @"\\Server\Server Printer";
    crystalReport.PrintToPrinter(1,false,0,0);

    But I still get the following Error:
    CrystalDecisions.CrystalReports.Engine.InternalException: Error in File C:\WINDOWS\TEMP\temp_b29aeb15-c5f3-4426-a063-4edf6c5cb3b8.rpt: Request cancelled by the user.

    If anyone has a solution for this that works Please post it thanks!

  2. #17
    Join Date
    Jan 2005
    Posts
    2

    Re: Printing Crystal report thro' ASp.Net

    Hi,

    I have the same problems. I have modify my machine.config with userName="SYSTEM" and modifiy also my registry HKEY_USERS\.DEFAULT ... but I see still my local printer. I have reboot my machine, reregister aspnet.
    Any other idea ?
    Thank You

  3. #18
    Join Date
    Sep 2005
    Posts
    8

    Question Re: Printing Crystal report thro' ASp.Net

    i have the same problems.
    I setup my Web application to print from a WebServer. I have setup the
    account so that it can print correctly. However, it can only print if
    the printer is connected to Win98 but if the

    printer is connected to Win2000/XP, it throws an error:

    Error in File xxx Request cancelled by the user.


    Here is my code to print over the web:

    Dim x As ReportDocument = New ReportDocument()
    x.PrintOptions.PrinterName = "xxx"
    x.PrintToPrinter(1, True, 1, 1) '(eror on this line)


    Please give me a solution
    thank u all

  4. #19
    Join Date
    Oct 2005
    Posts
    1

    Smile Re: Printing Crystal report thro' ASp.Net

    Hi achonk81 and all!!

    Not sure this may help you, but this is how I solved the problem:

    Instead of trying to print the crystal report by using PrintToPrinter method, I export immediately the report in PDF. After the export, the report will be viewed in Acrobat Reader, and the user will be able to save the report wherever he wants or to print it, and he can choose on which printer he wants to print the report, comparing with the PrintToPrinter method for which you must specify a printer. And PDF display the report as you designed it, with page break. It is much more user friendly than the crystal report web viewer and really less trouble. Here the web site where I found how to export the report in PDF. If you put directly the code in the Page_Load function, the report will open by default in PDF.

    http://www.c-sharpcorner.com/Code/20...rtInASPNET.asp

    Hope this help and that I'm not too late

    Mara

  5. #20
    Join Date
    Sep 2005
    Posts
    8

    Re: Printing Crystal report thro' ASp.Net

    thanx mara jade for your suggestion.
    But in this case i want to print invoice so i need to print directly to the printer insteadly view the report first. if you have other suggestion i will be gratefull

  6. #21
    Join Date
    Nov 2005
    Posts
    1

    Re: Printing Crystal report thro' ASp.Net

    A solution we have implemented for this problem is if the printer itself has a network address.

    Add the printer as a local printer to your web server box connected by a Standard TCP/IP port.

    With the Add Printer Wizard
    1) Select Local Printer
    2) Choose to "Create a new port"
    3) Select Port Type: "Standard TCP/IP Port"
    4) Provide the IP address for the printer
    5) Select the appropriate printer driver
    6) Give the Printer the desired name, ie. "TESTPRINTER"

    This will allow you to send your reports directly to a networked printer without a need to provide the server name from which the printer is accessible by using the standard
    Report.PrintOptions.PrinterName = "TESTPRINTER"

    It doesn't necessarily allow you to access a printer on another server but it does allow you to send print jobs directly to a networked printer with is typically the desired end result.

  7. #22
    Join Date
    Jan 2006
    Posts
    1

    Re: Printing Crystal report thro' ASp.Net

    Hi, I did a search in Google for this solution and found your posts. You saved me alot of time by trying all those things they suggested. I'm not sure if you figured it out since it was last year but I found the solution. I just started working with Crystal in .NET. Anyway all you have to do is:

    You were right in trying to assign it this way.
    crpt.PrintOptions.PrinterName = "\\banupriya\hp LaserJet 1300 PCL 6"

    It kept giving a problem because it was intrepreted this way:
    crpt.PrintOptions.PrinterName = "\banupriyahp LaserJet 1300 PCL 6"

    What you have to do is assign it this way:
    crpt.PrintOptions.PrinterName = "\\\\banupriya\\hp LaserJet 1300 PCL 6"

    Each set of "\\" represents one "\" so since you need 2 "\\" in the beginning you have to initialize it with 4 "\\\\" so it can be intrepreted like this:
    crpt.PrintOptions.PrinterName = "\\banupriya\hp LaserJet 1300 PCL 6"

  8. #23
    Join Date
    Mar 2008
    Posts
    1

    Re: Printing Crystal report thro' ASp.Net

    same i am trying from nearly 3 months but i didnt get any solution.
    I am printing a file to a network printer from webservice which is running from IIS. When i execute the code directly from Visual Studio it prints but when i execute by putting URL in addressbar ie running through IIS it does not prints. But it prints on local printer.

    The second thing is i have given all rights to aspnet user also iwam user.
    Printer is shared also have given full control to everyone. Also i hav tried all things mentioned above. As my company is Microsoft gold partner we hav put this case on their helpdesk but i am strange that they are also not able to find a solution on this.
    I m fed up now tried everything given all rights to all things where security is define..windows authentication is also enabled for VD and anonymous user is enabled.

    Any one knows the correct solution???

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured