HTML转pdf文件
作者:互联网
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(); } }
标签:文件,doc,PdfDocument,htmlToPdf,html,new,HTML,HtmlToPdf,pdf 来源: https://www.cnblogs.com/tangchun/p/14603462.html