微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

iTextSharp:HTML 到 PDF 更改字体

如何解决iTextSharp:HTML 到 PDF 更改字体

    Response.ContentType = "application/pdf"
    response.addheader("content-disposition","attachment;filename=Panel.pdf")
    Response.Cache.SetCacheability(HttpCacheability.NoCache)
    Dim sw As New StringWriter()
    Dim hw As New HtmlTextWriter(sw)
    pnlchecklist.RenderControl(hw)
    Dim sr As New StringReader(sw.ToString())
    Dim pdfDoc As New Document(PageSize.A4,25.0F,25.0)
    Dim htmlparser As New HTMLWorker(pdfDoc)
    PdfWriter.GetInstance(pdfDoc,Response.OutputStream)
    pdfDoc.open()
    htmlparser.Parse(sr)
    pdfDoc.Close()
    Response.Write(pdfDoc)
    Response.End()

您好,pnlchecklist 是我的 asp.net 面板,其中包含一个 HTML 表格和 asp.net Gridview。我可以将它们导出为 pdf,但我想更改 pdf 的字体系列、字体大小和填充。

我做了很多研究,但仍然找不到正确的方法

请帮忙。非常感谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。