« Return to Thread: html to pdf conversion

html to pdf conversion

by PKSINGH :: Rate this Message:

Reply to Author | View in Thread

Hi,
     I wanted to convert my html files to pdf .I have tried iTextSharp but could not get an API which takes html file as input and give me pdf.
i tried using below code but getting "Document has no pages" ERROR.
Please help me to know how to use iTEXTSHARP
Thanks


            Document document = new Document(PageSize.A4);
            PdfWriter pdf = PdfWriter.GetInstance(document, new FileStream("C:\\HelloWorld.pdf", FileMode.Create));
            document.Open();
           string htmlStr = "This is my test string";
           System.Xml.XmlTextReader _xmlr = new System.Xml.XmlTextReader(new StringReader(htmlStr));
            HtmlParser.Parse(document, _xmlr );
            document.Close();

 « Return to Thread: html to pdf conversion

LightInTheBox - Buy quality products at wholesale price!