I am running into a problem with the btnPdf.
on pdfDoc.Close it gives me an IOException was unhandled by user code. The detail is The document has no pages.
I have a populated grid. The only changes I made were to change the filename to filename LotGrid.pdf and the grid name to the name of my gridview
Protected Sub btnPdf_Click(sender As Object, e As EventArgs) Handles btnPdf.Click
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=LotGrid.pdf")
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Dim sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
gvPastCnt.AllowPaging = False
gvPastCnt.DataBind()
gvPastCnt.RenderControl(hw)
Dim sr As New StringReader(sw.ToString())
Dim pdfDoc As New Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 0.0F)
Dim htmlparser As New HTMLWorker(pdfDoc)
PdfWriter.GetInstance(pdfDoc, Response.OutputStream)
pdfDoc.Open()
htmlparser.Parse(sr)
pdfDoc.Close()
Response.Write(pdfDoc)
Response.End()
End Sub
Thanks...