yes,
when i try to open pdf it gives message like "adobe reader could not open 'test1.pdf' becoz it is not a supported file".
when i do same with dialogue box and than save and open pdf file, it works fine.
my code is below, it is same as u suggest
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
Me.Page.RenderControl(hw)
Dim sr As New StringReader(sw.ToString())
Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 100.0F, 0.0F)
Dim htmlparser As New HTMLWorker(pdfDoc)
Dim ms As New MemoryStream()
PdfWriter.GetInstance(pdfDoc, ms)
pdfDoc.Open()
htmlparser.Parse(sr)
Dim file As New FileStream(Server.MapPath("~/invoice_pdf/") & "Test1.PDF", FileMode.Create, System.IO.FileAccess.Write)
Dim bytes As Byte() = New Byte(ms.Length - 1) {}
ms.Read(bytes, 0, CInt(ms.Length))
file.Write(bytes, 0, bytes.Length)
file.Close()
pdfDoc.Close()
ms.Close()
thanks