HtmlForm form = new HtmlForm(); form.Controls.Add(Grdpick); StringWriter sw = new StringWriter(); HtmlTextWriter hTextWriter = new HtmlTextWriter(sw); form.Controls[0].RenderControl(hTextWriter); string html = sw.ToString(); Document Doc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); PdfWriter.GetInstance(Doc, new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\pickslip\\pickslip-" + profno + ".pdf", FileMode.Create)); Doc.Open(); Chunk chunk1 = new Chunk("Trident Services Pvt. Ltd. \n\n", FontFactory.GetFont("Verdana", 20)); Paragraph p1 = new Paragraph(); p1.Alignment = Element.ALIGN_CENTER; p1.Add(chunk1); string datenow = convertdate.changeformatDate(DateTime.Now); Chunk chunk2 = new Chunk(" Pick Slip No : " + profno + " Date :" + datenow + " \n", FontFactory.GetFont("Verdana", 10)); Paragraph p2 = new Paragraph(); p2.Alignment = Element.ALIGN_LEFT; p2.Add(chunk2); // //Chunk chunk4 = new Chunk(" Date :" + datenow + " \n", FontFactory.GetFont("Verdana", 10)); //Paragraph p4 = new Paragraph(); //p4.Alignment = Element.ALIGN_RIGHT; //p4.Add(chunk4); Chunk chunk3 = new Chunk(" Customer : " + partyname + " \n ESN : " + ESN + " Branch : " + Session["BrnName"].ToString() + "\n", FontFactory.GetFont("Verdana", 10)); Paragraph p3 = new Paragraph(); p3.Alignment = Element.ALIGN_LEFT; p3.Add(chunk3); Doc.Add(p1); Doc.Add(p2); Doc.Add(p3); // Doc.Add(p5); // Doc.Footer = new HeaderFooter(footerphrase, footerphrase); // Doc.Add(footerphrase); System.Xml.XmlTextReader xmlReader = new System.Xml.XmlTextReader(new StringReader(html)); HtmlParser.Parse(Doc, xmlReader); Doc.Close(); string Path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\pickslip\\pickslip-" + profno + ".pdf";
OnEndPage
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)