Response.contenttype For Pdf In Asp

Posted : admin On 11.09.2019
Response.contenttype For Pdf In Asp 4,3/5 9447 votes

The ContentType property specifies the HTTP content type for the response. If no ContentType is specified, the default is text/HTML. I am trying to open a document read from database. The document can be of any type such as JPG, PDF, EXCEL, WORD, TEXT, etc. I am wondering what value I should assign.

Pdf

Here is the code i have on a page. <% Response.AddHeader 'Content-Disposition', 'attachment; filename=PressRelease.pdf' Response.ContentType = 'application/pdf' Response.Write('I am here')% when i try to open it, it opens Acrobat Reader but the Acrobat Reader gives me an error in the form of a message box with this message 'Acrobat could not open 'PressRelease1.pdf' because it is either not a supported file type or because the file has been corrupted (for example, it was sent as an email attachment and wasn't correctly decoded).' Any ideas?:) SD.

See More On Stackoverflow

Thanks for the feedback folks, What i really wanted to do was. Create a PDF file on the fly.

Convert an ASP page into a PDF. You can convert aSP files into word, excel etc, by changing the response.contenttype. I was able to convert it into PDF similarly in the past. But now, i am having trouble. Ftb, Do you want to create a.pdf file on the fly? AgentSmith007, your method sounds complicated, is there a simpler solution?

Hongjun, I am trying to create a PDF on the fly and not stream an existing PDF. Thank you.:) SD.

I am trying to display a PDF file (which I am being passed from a web service as a binary stream) in a browser, but I am being prompted to save the file instead. I don't want the user to be prompted; I just want the PDF to be displayed. Here is the code: Dim binaryData As Byte binarydata = GetDataHere Response.ContentType = 'application/pdf' Response.BinaryWrite(binar yData) Response.End I also tried adding Response.Flush and Response.Close just for good measure, but it didn't help. I'm using ASP.NET.

Arnav and khushi love scene 120. One of Hindi Television's most popular show, Iss Pyaar Ko Kya Naam Doon touched new heights of popularity when it hit the small screen. 6th June 2011 is when all of it began. The show made Arnav Singh Raizada (Barun Sobti) a household name and gave Khushi Kumari Gupta (Sanaya Irani) a new image in the world of entertainment. The love story between Arnav and Khushi, the characters of the show was loved by people worldwide. The song hits you straight in the feels, doesn't it?