I have been able to create the PDF without too many problems, but it is not formatted the way I would like/need.

I am producing the PDF from a web page TextBox which the end user is running TinyMCE on (and is effectivly using it was a word processor), but the pint is currently showing the HTML code.

How do I get the PDF to not show the HTML, but to show the text with all formatting (including images and tables), as is done when printing?

The code I am using is shown below:

Dim doc As New Document()
        PdfWriter.GetInstance(doc, New FileStream("C:\1.pdf", FileMode.Create))
        doc.Open()
        'Dim text As String = Notes.Text
        doc.Add(New Paragraph(Notes.Text))
        doc.Close()

I managed to solve this myself using the following bit of code:

Dim reader As System.Xml.XmlTextReader = New System.Xml.XmlTextReader(New StringReader("<div>" + Notes.Text + "</div>"))
        reader.WhitespaceHandling = System.Xml.WhitespaceHandling.None

I hope this helps someone else with the same question.

Can u please post the full working code please? I am urgently in need of it.

Thanks in advance,
Dharmesh

This question has already been answered. Start a new discussion instead.