HTML转pdf文件
时间:2021-04-01 00:49:26
收藏:0
阅读:42
NUGET 安装 Select.HtmlToPdf库
代码如下:
public class PdfUtils { /// <summary> /// html字符串转PDF /// </summary> /// <param name="html">html</param> /// <param name="pdfFileName">生成的pdf路径</param> public static void HtmlToPdfFile(string html, string pdfFileName) { HtmlToPdf htmlToPdf = new HtmlToPdf(); var docStr = htmlToPdf.ConvertHtmlString(html); PdfDocument doc = new PdfDocument(); doc.Append(docStr); doc.Save(pdfFileName); doc.Close(); } }
原文:https://www.cnblogs.com/tangchun/p/14603462.html
评论(0)