export to PDF problem

S

Sze

I got a method to export the report to PDF directly, However, it sometimes
work (export the pdf in 5 secs) but sometimes. (there is dialog box prompt
out and said downloading.........) , and the doc can't export as pdf


Public Sub ExportToCrystalPDF(ByVal Filter As String, ByVal Filename As
String)
Dim Login As New MasterData.Login
Dim rptCount As New
CrystalDecisions.CrystalReports.Engine.ReportDocument()
rptCount.Load(Server.MapPath("./Reports/" + Filename + ".rpt"))
' Dim customerFilePath As String =
Server.MapPath("App_Data\FineArtMaster.xsd")
Login.Sub_CrystalLogin(rptCount)

Dim crParameterFieldDefinitions As
CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions =
rptCount.DataDefinition.ParameterFields

' rptCount.RecordSelectionFormula = "TRUE and
{mounting.mounting} = ""Mounting Type 1"""
rptCount.RecordSelectionFormula = Filter
Dim crExportOptions As ExportOptions

crExportOptions = rptCount.ExportOptions
With crExportOptions
.FormatOptions = New PdfRtfWordFormatOptions()
.ExportFormatType = ExportFormatType.PortableDocFormat
End With

Dim req As ExportRequestContext = New ExportRequestContext()
req.ExportInfo = crExportOptions


Dim st As System.IO.Stream

st = rptCount.FormatEngine.ExportToStream(req)

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment; filename= " &
Filename & ".pdf")

Dim b(st.Length) As Byte
st.Read(b, 0, st.Length)
Response.BinaryWrite(b)

Response.End()
Response.Close()

rptCount.Dispose()
st.Dispose()

End Sub
 
A

Allen Chen [MSFT]

Hi,
I got a method to export the report to PDF directly, However, it sometimes
work (export the pdf in 5 secs) but sometimes. (there is dialog box prompt
out and said downloading.........) , and the doc can't export as pdf

To resolve this issue I think first we need to identify whether it's a
server side issue or client side issue.

Could you please set a breakpoint at:

Response.End()

Can the breakpoint be hit when it doesn't work?

In addition, you mentioned "there is dialog box prompt
out and said downloading.........". Could you share a screenshot of that
dialog box?

BTW, which browser are you using?

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Allen Chen [MSFT]

Hi,
I got a method to export the report to PDF directly, However, it sometimes
work (export the pdf in 5 secs) but sometimes. (there is dialog box prompt
out and said downloading.........) , and the doc can't export as pdf

Do you have any progress on this issue?

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top