Crystal Report Viewer in ASP.NET Problem
Dear friends,
I have made a report in .NET environment by crystal report. I have loaded it in a web form with a crystal report viewer.
It is working good. But when I print the report it prints Report Name and Page No on the top of the paper and the report url on the bottom of the paper. I don't want to view these things on my report print out.
Can anyone help me to do this.
Best Regards,
-Rajib
Re: Crystal Report Viewer in ASP.NET Problem
Printing directly from the web page?
Re: Crystal Report Viewer in ASP.NET Problem
Thank u mendhak for ur response.
Yes. I am printing it directly from web page. But I don't want to print those unnecessary things that I have already mentioned.
-Rajib
Re: Crystal Report Viewer in ASP.NET Problem
When printing from a webpage, those details WILL show up. If you print using CR's features, it will be printed without those details as CR uses different formats (PDFS,XLS) or an ActiveX Control to do the printing.
Re: Crystal Report Viewer in ASP.NET Problem
Ok, thats good. But I don't know how CR's features can be used to print.
Please Help me in this case. I never used CR. I have always printed from page.
Rajib
Re: Crystal Report Viewer in ASP.NET Problem
Does your CR report have any export functionality? Can it export to PDF/XLS etc?
Re: Crystal Report Viewer in ASP.NET Problem
Actually I don't know how Crystal report can be exported to PDF format.
--Rajib
Re: Crystal Report Viewer in ASP.NET Problem
Please Response.
I am waiting for u..
-Rajib
Re: Crystal Report Viewer in ASP.NET Problem
I've done something like this before:
VB Code:
Dim rptFiveDay As New FiveDayNotice
SQL = "EXEC sp_rptFiveDayNotice " & Session("FormNo")
adapter = New SqlDataAdapter(SQL, Ado.DataConnection)
adapter.Fill(ds, "FiveDayNotice")
rptFiveDay.SetDataSource(ds)
ExportData(rptFiveDay) 'Pass report to PDF
VB Code:
Public Sub ExportData(ByRef oRpt As Object)
Dim fs As IO.FileStream
Dim FileSize As Long
Dim oDest As New CrystalDecisions.Shared.DiskFileDestinationOptions
Dim ExportFileName As String = System.IO.Path.GetTempPath & Environment.TickCount.ToString & ".pdf"
oRpt.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
oRpt.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
oDest.DiskFileName = ExportFileName
oRpt.ExportOptions.DestinationOptions = oDest
oRpt.Export()
Response.Clear()
Response.Buffer = True
Response.AddHeader("Content-Type", "application/pdf")
fs = New IO.FileStream(ExportFileName, IO.FileMode.Open)
FileSize = fs.Length
Dim bBuffer(CInt(FileSize)) As Byte
fs.Read(bBuffer, 0, CInt(FileSize))
fs.Close()
Response.BinaryWrite(bBuffer)
Response.Flush()
Response.Close()
End Sub