<asp:panel ID="ppanel" runat="server"> <table> <tr> <td valign="top" align="left"> <asp:Label ID="Label1" runat="server"></asp:Label> </td> </tr> <tr> <td align="left"> <asp:PlaceHolder ID="plBarCode" runat="server" /> </td> </tr> <tr> <td valign="bottom"><asp:Label ID="Label2" runat="server"></asp:Label> </td> </tr> </table> </asp:panel>
Response.ContentType = "application/pdf" Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf") Response.Cache.SetCacheability(HttpCacheability.NoCache) Dim sw As New StringWriter() Dim hw As New HtmlTextWriter(sw) ppanel.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) PdfWriter.GetInstance(pdfDoc, Response.OutputStream) pdfDoc.Open() htmlparser.Parse(sr) pdfDoc.Close() Response.Write(pdfDoc) Response.End()
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)