Archit Shrivastava

Archit Shrivastava

  • NA
  • 416
  • 117.3k

multiple tables in string builder

Sep 4 2018 6:23 AM
i am creating string builder html table and now i want to print same table for multiple times in pdf document. here my code sample
 
StringBuilder sb = new StringBuilder();
sb.Append("<table border=1 width = 400 height = 100 >");
sb.Append("<tr width = 20><td width=7% height = 50% width=70% rowspan =4 ><img src= C:\\Users\\Archit\\Downloads\\a1.png width = 25 height =30 left-margin =50> </td><br><img src= D:\\HOLDER_SIGN\\sign.jpg width = 30 height =20 ><td >" + (Reg) + "</td></tr>");
sb.Append("<tr><td>" + (name) + "</td></tr>");
sb.Append("<tr><td>" + (rank) + " </td></tr>");
sb.Append("<tr><td>" + (Aadhar) + "<img src= D:\\HOLDER_SIGN\\sign.jpg width = 30 height =20 >" + " </td></tr>");
sb.Append("</table>");
StringReader sr = new StringReader(sb.ToString());
string path = "C:\\Users\\Archit\\Desktop\\test.pdf";
StringWriter sw = new StringWriter();
var output = new FileStream(path, FileMode.Create);
iTextSharp.text.Document pdfDoc = new iTextSharp.text.Document(PageSize.A4, 10F, 10F, 10F, 0F);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
iTextSharp.text.pdf.PdfWriter.GetInstance(pdfDoc, output);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
 
 how to print this table multiple times in pdf document.?
 

Answers (1)