:working:
Hi all.

1)Trying to create a pdf page from a html page, but the table shown on the
pdf page was not in its shape. 2)Could not be able to use some designs with
the stylesheet options, too.:-((

Pasting the piece of code for reference. Need urgent help from you, please
make it fast!


private void ParsingHTMLSnippets()
    {
        Session.Add("myName", "Subhadeep");
        Document document = new Document(PageSize.A4, 5.0f, 5.0f, 5.0f,
5.0f);
                try
                        {

                //StreamReader sr = new StreamReader(new
MemoryStream(Encoding.UTF8.GetBytes(text)), Encoding.UTF8);
                //ArrayList elements =
iTextSharp.text.html.simpleparser.HTMLWorker.ParseToList(sr, ss);
                                StyleSheet styles = new StyleSheet();
                                styles.LoadTagStyle("ol", "leading", "16,0");
 
                                PdfWriter.GetInstance(document, new
FileStream(Request.PhysicalApplicationPath+"\\"+"html3.pdf",
FileMode.Create));
                                document.Open();
                                System.Collections.ArrayList objects,objects1;
                StreamReader sr = new StreamReader(new
MemoryStream(Encoding.UTF8.GetBytes(Session["myName"].ToString())),
Encoding.UTF8);
                objects = HTMLWorker.ParseToList(new
StreamReader(Server.MapPath("../resources/list3.html"), Encoding.UTF8),
styles);
                objects1 = HTMLWorker.ParseToList(sr, styles);
               
                styles.LoadTagStyle("li", "face", "garamond");
                styles.LoadTagStyle("span", "size", "8px");
                styles.LoadTagStyle("body", "font-family", "times new
roman");
                styles.LoadTagStyle("body", "font-size", "10px");

                for (int k = 0; k < objects.Count; k++)
                {
                    document.Add((IElement)objects[k]);
                    document.Add((IElement)objects1[k]);
                }
                document.NewPage();

             //   objects = HTMLWorker.ParseToList(new
StreamReader(Server.MapPath("../resources/rupa.html"), Encoding.Default),
styles);
             //for (int k = 0; k < objects.Count; k++)
             //    document.Add((IElement)objects[k]);
                        }
                        catch (System.Exception ex)
                        {
                                Response.Write(ex.StackTrace);
 
                                Response.Write(ex.Message);
                        }
                        document.Close();
            Response.Redirect("~/html3.pdf");
                }

Thanks.
Subhadeep
-- 
View this message in context: 
http://www.nabble.com/Help-needed-for-html-to-pdf-conversion-tf4690066.html#a13404294
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to