Html到Pdf的转换

Html到Pdf的转换

问题描述:

Hi
使用Vb.Net中的iTextsharp将html代码转换为pdf。但我无法将样式应用于转换后的pdf。我尝试使用此代码应用样式:

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)
                        document.Open()
                        For Each item As Object In parsedList
                            document.Add(DirectCast(item, IElement))
                        Next
                        document.Close()
                    End Using
                End Using

访问这里......



http://www.mindfiresolutions.com/HTML-to-PDF-conversion-using-iTextsharp-1088.php [ ^ ] br />






http://forums.asp.net/t/1199774.aspx [ ^ ]
visit here...

http://www.mindfiresolutions.com/HTML-to-PDF-conversion-using-iTextsharp-1088.php[^]

or

http://forums.asp.net/t/1199774.aspx[^]