Использование ASP.NET сгенерировать файл. pdf
привет,
как сгенерировать pdf файл в asp.net внутри pdf добавить таблицу с данными
Что я уже пробовал:
Document pdfDoc = new Document(); PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, HttpContext.Current.Response.OutputStream); pdfDoc.Open(); string strHTML = @" <div style='text-align: center; width: 80%'> ABC </div> <table border='1' style='border-spacing: 0; border-style: solid; border-width: thin; padding: 0; width: 80%; height: 100%'> <tr> <td colspan='6' rowspan='2'> <table> <tr> <td>@@@@@</td> </tr> <tr> <td>@@@@@</td> </tr> </table> </td> <td colspan='2'>*************</td> <td colspan='2'>*************</td> </tr> <tr> <td colspan='2'>***</td> <td colspan='2'>***</td> </tr> <tr> <td colspan='6' rowspan='2'> <table> <tr> <td>@@@@@</td> </tr> <tr> <td>@@@@@</td> </tr> </table> </td> <td colspan='2'>***</td> <td colspan='2'>***</td> </tr> <tr> <td colspan='2'>***</td> <td colspan='2'>***</td> </tr> <tr> <td colspan='6'>***</td> <td>***</td> <td>***</td> <td>***</td> <td>***</td> </tr> <tr> <td colspan='6' rowspan='5'> <table> <tr> <td>@@@@@</td> </tr> <tr> <td>@@@@@</td> </tr> <tr> <td>@@@@@</td> </tr> <tr> <td>@@@@@</td> </tr> <tr> <td>@@@@@</td> </tr> </table> </td> <td>***</td> <td>***</td> <td>***</td> <td>***</td> </tr> <tr> <td>***</td> <td>***</td> <td>***</td> <td>***</td> </tr> <tr> <td>***</td> <td>***</td> <td>***</td> <td>***</td> </tr> <tr> <td>***</td> <td>***</td> <td>***</td> <td>***</td> </tr> <tr> <td>***</td> <td>***</td> <td>***</td> <td>***</td> </tr> <tr> <td colspan='6'>***</td> <td colspan='3'>***</td> <td>***</td> </tr> <tr> <td colspan='10' rowspan='1'>***</td> </tr> <tr> <td colspan='8' rowspan='4'>***</td> </tr> <tr> <td colspan='2'>***</td> </tr> </table> <div style='text-align: center; width: 80%'> ABC <br /> ABC </div>"; HTMLWorker htmlWorker = new HTMLWorker(pdfDoc); htmlWorker.Parse(new StringReader(strHTML)); pdfWriter.CloseStream = false; pdfDoc.Close(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=Test.pdf"); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Write(pdfDoc); Response.Flush(); Response.End();