Answered by:
How to Save the PDF by Specific name in I.E

Question
-
User-1566075271 posted
Hi all,
I have one requirement when we save any generated PDF it's taking the name of page but I want to give the specific name. I have tried it with code change but no help,
In Mozilla its working fine but in I.E. its not working , Any one face the issue before please help me.
Code :Dim report As Byte() = ReportSrv.Document_Get(version, reportTemplateID, caseno, User.Identity.Name, UseThisRequestForRest) Response.ContentType = "application/PDF" Response.Filter = New System.IO.Compression.DeflateStream(Response.Filter, CompressionMode.Compress) Response.AppendHeader("Content-Encoding", "deflate") Response.AppendHeader("Content-Disposition", "inline; filename='" + caseno + "'.pdf") Response.OutputStream.Write(report, 0, report.Length) Response.End()
Monday, September 16, 2013 4:00 AM
Answers
-
User-417640953 posted
Hi,
I’m glad to you post the issue to asp.net forum.
What I understand from your description is that you want to show the pdf inline in IE. And save it as the user want to.
For this issue, we need to set the content-disposition and content-type headers of response.
Others have provided some practicable solutions in below link.
http://forums.asp.net/p/1036628/1436084.aspx
Hope this helps, thanks.
Best Regards!
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, September 18, 2013 7:02 AM
All replies
-
User388626632 posted
Replace
Response.AppendHeader("Content-Disposition", "inline; filename='" + caseno + "'.pdf")
With
Response.AddHeader("Content-Disposition", "attachment; filename='" + caseno + "'.pdf")
Monday, September 16, 2013 4:12 AM -
User-1566075271 posted
Thanks for the reply,
But now report is not opening in browser, Can't we do something in inline only ??? Because I need to open the report in browser . and need the specific file name also ??
Regards
Raman
Monday, September 16, 2013 5:38 AM -
User388626632 posted
Let's clarify the difference between inline and attachment
if inline browser will first try to open the file for ex. if browser have pdf reader it will open by reader else it will open file save dialogue
if attachment browser will be forced to open file save dialogue
http://dotanything.wordpress.com/2008/05/30/content-disposition-attachment-vs-inline/
Monday, September 16, 2013 6:51 AM -
User-1566075271 posted
Thanks again for the reply , I got you,, But I want to save the pdf after showing into the browser which can be possible by inline. than user can save the pdf if he/she want to save it.
Or any other way to get my requirment done. Please help me ???
FYI :: I must have use I.E only
Regard
Ambivert
Monday, September 16, 2013 7:23 AM -
User388626632 posted
Which pdf addon in browser do you have? I think there is a button to save pdf in addon
Monday, September 16, 2013 9:08 AM -
User-417640953 posted
Hi,
I’m glad to you post the issue to asp.net forum.
What I understand from your description is that you want to show the pdf inline in IE. And save it as the user want to.
For this issue, we need to set the content-disposition and content-type headers of response.
Others have provided some practicable solutions in below link.
http://forums.asp.net/p/1036628/1436084.aspx
Hope this helps, thanks.
Best Regards!
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, September 18, 2013 7:02 AM