|
 |
aspx thread: Printing a Crystal Report on client's default printer
Message #1 by mudar@e... on Wed, 8 May 2002 20:15:33
|
|
How do I print a Crystal Report on client's default printer?
Message #2 by Feduke Cntr Charles R <FedukeCR@m...> on Wed, 8 May 2002 15:24:55 -0400
|
|
Uh, if its ASP.NET we're talking about, try something like this:
<input type="button" text="Print" onClick="document.print();" />
Note: no `RunAt="server"' in that tag; the onClick should be handled
client-side by JavaScript.
- Chuck
-----Original Message-----
From: mudar@e... [mailto:mudar@e...]
Sent: Wednesday, May 08, 2002 4:16 PM
To: ASP+
Subject: [aspx] Printing a Crystal Report on client's default printer
How do I print a Crystal Report on client's default printer?
Message #3 by mudar@e... on Wed, 8 May 2002 20:34:03
|
|
Can you please tell me the JavaScript code to do it?
> Uh, if its ASP.NET we're talking about, try something like this:
<input type="button" text="Print" onClick="document.print();" />
Note: no `RunAt="server"' in that tag; the onClick should be
handled
client-side by JavaScript.
- Chuck
-----Original Message-----
From: mudar@e... [mailto:mudar@e...]
Sent: Wednesday, May 08, 2002 4:16 PM
To: ASP+
Subject: [aspx] Printing a Crystal Report on client's default printer
How do I print a Crystal Report on client's default printer?
Message #4 by Feduke Cntr Charles R <FedukeCR@m...> on Wed, 8 May 2002 15:33:53 -0400
|
|
The JavaScript code to do it is (if I'm not mistaken):
document.print();
HTH,
- Chuck
-----Original Message-----
From: mudar@e... [mailto:mudar@e...]
Sent: Wednesday, May 08, 2002 4:34 PM
To: ASP+
Subject: [aspx] RE: Printing a Crystal Report on client's default
printer
Can you please tell me the JavaScript code to do it?
> Uh, if its ASP.NET we're talking about, try something like this:
<input type="button" text="Print" onClick="document.print();" />
Note: no `RunAt="server"' in that tag; the onClick should be
handled
client-side by JavaScript.
- Chuck
-----Original Message-----
From: mudar@e... [mailto:mudar@e...]
Sent: Wednesday, May 08, 2002 4:16 PM
To: ASP+
Subject: [aspx] Printing a Crystal Report on client's default printer
How do I print a Crystal Report on client's default printer?
Message #5 by "kozsu" <kozsu@s...> on Thu, 9 May 2002 09:28:06 +0300
|
|
if it is on asp.net and your client is not in your lan, then crystal reports
says that you can it in two ways.
1. put off all the pagebreaks, turn on navigation bar and selection column
on the left and then print like a normal web page. on this solution it is
not guaranteed that all page breaks appear in preferred order. (i don't
recommend this way.)
code looks like this:
CrystalReportViewer1.SeparatePages = False
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.DisplayToolbar = False
2. show your report just normal, and put a button named like "printer
friendly".. on that button, you should convert your report to another format
like pdf or word doc. and just send this output as reponse. client has to
have that software that can open your format installed. (this works fine)
code of pdf looks like this:
'The following line of code loads the sample report "Chart.rpt" that
installs
' with Visual Studio .NET
crReportDocument.Load("C:\Program Files\Microsoft Visual Studio
.NET\Crystal Reports\Samples\Reports\Feature Examples\Chart.rpt")
Fname = "c:\exports\" & Session.SessionID.ToString & ".pdf" 'this
folder has to be created before
crDiskFileDestinationOptions = New DiskFileDestinationOptions()
crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
crReportDocument.Export()
' The following code writes the pdf file to the Client's browser.
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
'delete the exported file from disk
System.IO.File.Delete(Fname)
|
|
 |