The following code creates a pdf that downloads after you press the link / button.
How do you make it happend that the pdf opens inside the browser without the automatic download?
'
' GET: /PDF
Function Index() As FileResult
Dim filestream As Stream = generatePDF()
HttpContext.Response.AddHeader("content-disposition", "attachment; filename=Lijstmetmensenenmiddelen.pdf")
Return New FileStreamResult(filestream, "application/pdf")
End Function
Private Function generatePDF() As Stream
'' magic will happen here
Dim memStream As MemoryStream = New MemoryStream()
Dim doc As New Document()
PdfWriter.GetInstance(doc, Response.OutputStream)
doc.AddCreationDate()
doc.Open()
Dim para As New Paragraph()
para.Add("Dit is een paragrafstring balbalbalal")
doc.Add(para)
doc.Close()
Return memStream
End Function
Found the answer on this blog : http://nickstips.wordpress.com/2011/01/17/asp-net-mvc-displaying-a-pdf-document-in-the-browser/
should be