本文介绍了Html到Pdf的转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 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推荐答案 这篇关于Html到Pdf的转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-23 09:43