推荐类库
FreeSpire.Doc
可以直接保存成pdf格式
using System; using System.Collections.Generic; using System.Text; using Spire.Doc; namespace TalentNetwork.Util { public class SpireHelper { public static void R(string templatePath, string savePath,Dictionary<string,string> dic) { var doc = new Document(); doc.LoadFromFile(templatePath); foreach (var item in dic) { doc.Replace(item.Key, item.Value, false, false); } var guid = Guid.NewGuid().ToString(); doc.SaveToFile(savePath, FileFormat.PDF); doc.Close(); } } }