'How do I stop the text from being cut off when converting gridview to pdf?

GridView1.Columns[0].Visible = false; Response.ContentType = "application/pdf";

   Response.AddHeader("content-disposition", "attachment;filename=Equipment.pdf");
   Response.Cache.SetCacheability(HttpCacheability.NoCache);
   StringWriter sw = new StringWriter();
   HtmlTextWriter hw = new HtmlTextWriter(sw);
   HtmlForm frm = new HtmlForm();


   GridView1.Parent.Controls.Add(frm);
   frm.Attributes["runat"] = "server";
   frm.Controls.Add(GridView1);
   frm.RenderControl(hw);
   StringReader sr = new StringReader(sw.ToString());
   Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);//create a document object

   PdfWriter writer = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);//get a pdf writer instance

   pdfDoc.Open();//open the document
   XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr);//invoke XMLWorkerHelper.getInstance().parseXhtml(writer, document, new FileInputStream)

   pdfDoc.Close();//close the document

   Response.Write(pdfDoc);
   Response.End();

I want to convert Gridview to pdf with repeated column in every page using XMLWorkerHelper (Because the gridview contain images in every row and pdf should also contain that images) and stop the text from being cut off in new page of pdf . I have done above code there I can download the pdf with images but when ever a new page starts the last row is cutting into two pages and I also cannot find any solution for repeated column . So please help me .



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source