Header in pdf problem RRS feed

  • Question

  • 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();
                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);
    Is there any way to get the header in each page ?


    Monday, August 30, 2010 11:14 AM

All replies

  • User154154152 posted

    You can set the PdfPTable.HeaderRows property to the number of rows in yourPdfPTable's header.

    try this. Not sure about this solution, but hope it works for you.

    Mark As answer if it helps you.

    Tuesday, August 31, 2010 3:05 AM
  • User-1579656392 posted

    but i am not using any tables in the pdf.

    Tuesday, August 31, 2010 7:49 AM