Hello,
 I am using iTextsharp to convert HTMl to PDF using HTMLWorker and It works
fine with the normal fone sizes.
 But when i converted the text with font size around 30, the text in the pdf
was shrunk and there is no space between two lines. And also bottom of the
top line was messed with top of the below line.

  Here is my code:

    string s1 = "
with love,
the jackson family
jane, christopher & stacy
2010
";
 
    Document document = new Document(PageSize.A4, 80, 50, 30, 65);

    StringBuilder strData = new StringBuilder(string.Empty);
   
    //I have provided Path for the HTML which will be generated from
GridView content

    string strHTMLpath = Server.MapPath("MyHTML.html");

     //I have provided Path for the PDF file which will be generated from
HTML content

     string strPDFpath = Server.MapPath("MyPDF.pdf");

           StringWriter sw = new StringWriter();

            sw.WriteLine(Environment.NewLine);

            sw.WriteLine(Environment.NewLine);

            HtmlTextWriter htw = new HtmlTextWriter(sw);


            //Rendering the HtmlTextWriter


            lblhtml.RenderControl(htw);
                     
            StreamWriter strWriter = new StreamWriter(strHTMLpath, false,
Encoding.UTF8);

  after writing style attributes to the streamwriter, I am using HTMLWorker
to parse the html and send it into a Array list.

            ArrayList objects;

            document.NewPage();
            
            objects =
iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new 
StringReader(s1.ToString()),styles);

            for (int k = 0; k < objects.Count; k++)
            {

                document.Add((IElement)objects[k]);
                       
            }

   In string 's1' you can see the break tags, and when the 
 tag is only one two lines are messing,where as with two 
 tags output showing some gap.  I am attaching a file of output I am
getting.Is there any procedure to handle 
 tags when converting html to pdf.
     Can any one know about this issue,Please mail me.
http://www.nabble.com/file/p18332552/htmltopdf.pdf htmltopdf.pdf 
Regards,
Rajesh([EMAIL PROTECTED])
-- 
View this message in context: 
http://www.nabble.com/issue-with-line-spacing-when-converting-HTML-into-PDF-using-HTMLWorker-tp18332552p18332552.html
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to