Html到Pdf的转换 [英] Html to Pdf conversion

查看:106
本文介绍了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 [< a href =http://www.mindfiresolutions.com/HTML-to-PDF-conversion-using-iTextsharp-1088.phptarget =_ blanktitle =New Window> ^ ] 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[^]


这篇关于Html到Pdf的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆