User-1579656392 posted
Hey, I am using iTextSharp for to get my output file as pdf. I am having data in pdf and the pages are almost 20. Now what I want to show in all the pages is the same title on the top of each page. How do I get that ?
My code is like this:
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=example.pdf_" + DateTime.Now.ToString("MM-dd-yyyy") + "Time"+DateTime.Now.ToString("h-mmtt"));
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/pdf";
StringWriter stringwrite = new StringWriter();
HtmlTextWriter htmlwrite = new HtmlTextWriter(stringwrite);
StringWriter sw = new StringWriter();
HtmlTextWriter hw = new HtmlTextWriter(sw);
Paragraph brP = new Paragraph();
rptDepartmentInfo.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 40f, 40f, 50f, 50f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.NewPage();
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Is there any way to get the header in each page ?