Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
var paper =  _repo.VeryLatestPaper().Result;
            List list = new List(List.ORDERED);
            paper.Questions.ForEach(q => list.Add(q.Message));

            var doc1 = new Document(); 

            string path = "B:\\Test\\PDF";
            PdfWriter writer = PdfWriter.GetInstance(doc1, new FileStream(path + "/Doc1.pdf", FileMode.Create));
            writer.PageEvent = new PDFWriterEvents("This is a Test");


            doc1.Open();

            //new XMLParser().Parse(new StringReader(text));

            //XMLWorkerHelper.GetInstance().ParseXHtml(writer, doc1, new StringReader(text));



            doc1.Add(list);

            doc1.Close();


I am using the above code with the latest itextsharp to generate a pdf list. So far its working very excellently, until when I want to convert each itextsharp list from html to atleast plain text, or preferably formatted text with images if possible. Someone please assist me convert q.Message to pdf of plain text ready for rendering to pdf file with XMLWorker and this code here .

//new XMLParser().Parse(new StringReader(text));

//XMLWorkerHelper.GetInstance().ParseXHtml(writer, doc1, new StringReader(text));

Please note that I am not getting the html from a file, its from the database…
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900