Click here to Skip to main content
15,923,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is the code for the convertion.

VB
 Public Shared Function ExportHTM()
    Dim sbytes As [Byte]()
        Using mstream = New MemoryStream()
            Using PDF = New Document(iTextSharp.text.PageSize.A4, 5, 5, 15, 5)
                Using writer = PdfWriter.GetInstance( PDF, mstream )
                   PDF.Open()
                    Using StringWriter= New StringWriter()
                        Using HtmlTextWriter = New HtmlTextWriter(StringWriter)
              'How to apply  font and styles to pdfcontent' -- PDF content is a string and it contains html content
                            Using StringReader = New StringReader(pdfcontent)
                                Using htmlparser = New HTMLWorker( PDF)
                                    htmlparser.Parse(StringReader)
                                End Using
                            End Using
                        End Using
                    End Using
                    PDF.Close()
                End Using
            End Using
            sbytes = mstream.ToArray()
           mstream.Close()
        End Using
END function



Can anybody help me how can I apply styles to the pdfcontent?
Posted

Use Font & FontFactory classes for that.
See this, iTextSharp - working with fonts[^]. Blog uses C#, but certainly can get the idea from this.

-KR
 
Share this answer
 
You could use iTextSharp - Working with Fonts[^].
 
Share this answer
 

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