private byte[] MakePdf(string html) { try { var prince = new Prince(HttpContext.Current.Server.MapPath("~/CommandLine/PrinceEngine/bin/prince.exe")); prince.SetLicenseFile(HttpContext.Current.Server.MapPath("~/CommandLine/PrinceEngine/license/license.dat").Replace("\\", "/")); //prince.SetLicenseFile("../license/license.dat"); prince.SetHtml(true); //prince.SetFileRoot(tempPath.EndsWith("\\") ? tempPath.Substring(0, tempPath.Length - 1) : tempPath); prince.SetLog(HttpContext.Current.Server.MapPath("~/App_Data/Blobs/prince.log")); using (var ms = new MemoryStream(Encoding.UTF8.GetBytes(html)) { Position = 0 }) { using (var pdf = new MemoryStream()) { prince.ConvertMemoryStream(ms, pdf); return(pdf.ToArray()); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); return(null); } finally { } }