locked
Exported PDF File Format in Formview..? RRS feed

  • Question

  • User1159281904 posted

    Hi,

    I exported a form view or repeater into a PDF file.

    It looks nice on webpage with signle spacing. But when it exported to the PDF, double or larger space bewtween the lines appears.

    How can I reduce the space between the lines to a single space?

    Here is my code:

        protected void PDFExport()
        {
            Response.ContentType = "application/pdf";

            Response.AddHeader("content-disposition",

             "attachment;filename=GridViewExport.pdf");

            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            StringBuilder sb = new StringBuilder();

            StringWriter sw = new StringWriter();

            HtmlTextWriter hw = new HtmlTextWriter(sw);

            Repeater1.DataBind();

            Repeater1.RenderControl(hw);

            StringReader sr = new StringReader(sw.ToString());

            Document pdfDoc = new Document(PageSize.LETTER, 12f, 12f, 12f, 0f);
           

            HTMLWorker htmlparser = new HTMLWorker(pdfDoc); PdfWriter.GetInstance(pdfDoc, Response.OutputStream);

            pdfDoc.Open();

            htmlparser.Parse(sr);

            pdfDoc.Close();

            Response.Write(pdfDoc);

            Response.End();


        }

     

    Wednesday, January 13, 2010 5:26 PM

Answers