我正在使用iTextSharp制作pdf文件。
但是,源HTML中链接的外部CSS未显示在PDF中。
如何包含外部css文件以便iTextSharp正确呈现?
Dim doc As Document = New Document
PdfWriter.GetInstance(doc, New FileStream(Request.PhysicalApplicationPath + _
"\ListingDetails.pdf", FileMode.Create))
Dim content As String = File.ReadAllText(Server.MapPath("~/PDFPage.aspx"))
doc.Open()
Dim parsedHtmlElements = HTMLWorker.ParseToList(New StringReader(content), Nothing)
For Each htmlElement As Object In parsedHtmlElements
doc.Add(TryCast(htmlElement, IElement))
Next
doc.Close()