Click here to Skip to main content
14,878,219 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi Am converting html code to pdf using iTextsharp in Vb.Net. But am unable to apply style to the converted pdf. I attempted to apply style using this code:
Dim styles As StyleSheet = New StyleSheet()
               styles.LoadStyle("bbtd", "font-size", "4px")
               styles.LoadStyle("bbtd", "font-family", "Arial,Verdana")
               styles.LoadStyle("bbtd", "line-height", "17px")
  Using fs As New FileStream(Request.ApplicationPath & "/Print/Pf" & Session("User_id") & ".pdf", FileMode.Create)
                    PdfWriter.GetInstance(document, fs)
                    ' PdfPage.LANDSCAPE()
                    Using stringReader As New StringReader(StrContent)
             Dim parsedList = html.simpleparser.HTMLWorker.ParseToList(stringReader, styles)
                        For Each item As Object In parsedList
                            document.Add(DirectCast(item, IElement))
                    End Using
                End Using
Updated 22-Mar-17 0:17am

1 solution

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