new SE 0 Junior Poster in Training

Hi all,
now i'm working to convert html to pdf in asp.net..
i don't have any idea to make it..
now i have this code to convert it but have a problem..
anybody please help me see thid code or send me link as a guide..
i'm using iTextSharp to convert it

protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //create document
        Document document = new Document();
        try
        {
            //writer - have our own path!!! and see you have write permissions...
            PdfWriter.GetInstance(document, new FileStream(Server.MapPath("/") + "WordDoc/" + "parsetest.pdf", FileMode.Create));
            document.Open();

            //html -text - can be from database or editor too
            String htmlText = "<font  " +
           " color=\"#0000FF\"><b><i>Title One</i></b></font><font   " +
           " color=\"black\"><br><br>Some text here<br><br><br><font   " +
           " color=\"#0000FF\"><b><i>Another title here   " +
           " </i></b></font><font   " +
           " color=\"black\"><br><br>Text1<br>Text2<br><OL><LI>hi</LI><LI>how are u</LI></OL>";

            //make an arraylist ....with STRINGREADER since its no IO reading file...
            [U]ArrayList htmlarraylist = iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(new StringReader(htmlText), null);[/U]

            //add the collection to the document
            for (int k = 0; k < htmlarraylist.Count; k++)
            {
                document.Add((IElement)htmlarraylist[k]);
            }

            document.Add(new Paragraph("And the same with indentation...."));

            // or add the collection to an paragraph 
            // if you add it to an existing non emtpy paragraph it will insert it from
            //the point youwrite -
            Paragraph mypara = new Paragraph();//make an emtphy paragraph as "holder"
            mypara.IndentationLeft = 36;
            [U]mypara.InsertRange(0, htmlarraylist);[/U]
            document.Add(mypara);
            document.Close();
        }
        catch (Exception exx)
        {
            Console.Error.WriteLine(exx.StackTrace);
            Console.Error.WriteLine(exx.Message);
        }
    }

i have a problem with underline coding..

Thanks in advance

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.