ActiveReports for .NET Support

Started by ffmike at 12-03-2003 7:31 PM. Topic has 2 replies.

Print Search Rate
Sort Posts:    
   12-03-2003, 7:31 PM
ffmike is not online. Last active: 3/17/2005 12:37:12 AM ffmike

Not Ranked
Joined on 10-08-2003
Posts 5
PDF export from ASPX, e-mail file name problem

So, I've got an ASP.NET page, call it foo.aspx, that pumps out an ActiveReport named rptFoo like this:

Dim m_stream As New System.IO.MemoryStream
Dim rpt As New rptFoo
rpt.DataSource = dsReport
rpt.DataMember = "Report"
rpt.Run()
Me.PdfExport1.Export(rpt.Document, m_stream)
m_stream.Position = 0
Response.ContentType = "application/pdf"
Response.AddHeader("Content-Length", m_stream.Length.ToString())
Response.AddHeader("Content-Disposition", "inline; filename=Foo.pdf")
Response.BinaryWrite(m_stream.ToArray())
Response.End()

Now, this all works great, and pulls up the Acrobat document inside the browser. The problem comes when the user clicks on the Acrobat E-mail button, and sends the document. Instead of "Foo.pdf" the attachment (which is the valid PDF) comes across as "foo.aspx".

So, how do I fool Acrobat into thinking that the file it's dealing with is really foo.pdf when it comes time to send e-mail?


   Report 
   12-04-2003, 3:31 AM
Sergey is not online. Last active: 6/29/2011 11:13:11 PM Sergey

Top 10 Posts
Joined on 08-28-2004
Novosibirsk, Russia
Posts 3,015

DDStaff
Re: PDF export from ASPX, e-mail file name problem

Hello,
Firstly, the filename that Acrobat uses as the email attachment is really outside the realm of ActiveReports and is up to the Acrobat application.
Secondly, there is work-around, change line of code
Response.AddHeader("Content-Disposition", "inline; filename=Foo.pdf")
to
Response.AddHeader("Content-Disposition", "attachment; filename=Foo.pdf")




Sergey Abakumoff
GrapeCity
   Report 
   12-04-2003, 9:20 AM
ffmike is not online. Last active: 3/17/2005 12:37:12 AM ffmike

Not Ranked
Joined on 10-08-2003
Posts 5
Re: PDF export from ASPX, e-mail file name problem

Well, Acrobat presumably is getting the name based on something that the Web server is sending - but it looks like it may just be the original page name out of the HTTP request, which is annoying. I suppose I could rename the aspx page to Foo.pdf and then bind *.pdf to the ASP.NET processor in IIS, but ick.

I've tried attachment rather than inline, and it avoids this problem but brings up two others: (1) opens in a new window [yes, I know that's the whole point of a windowed environment, but this is an application for a naive bunch of unders] (2) You get the big scary "Danger Will Robinson!" dialog box asking them whether they want to download the attachment.

Bah.


   Report 
GrapeCity » Product Support » ActiveReports f... » Re: PDF export from ASPX, e-mail file name problem

Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.