我正在使用Select.HtmltoPdf。 下面ismy代碼:Html轉換爲PDF的PDF轉換
var directory = @"D:\Folder\";
html = html.Replace("/Content", HttpContext.Request.Url.GetLeftPart(UriPartial.Authority) + HttpContext.Request.ApplicationPath + "/Content");
var filePath = directory + Guid.NewGuid() + ".pdf";
var converter = new HtmlToPdf(1536,1536);
converter.Options.EmbedFonts = false;
converter.Options.ExternalLinksEnabled = true;
converter.Options.InternalLinksEnabled = true;
converter.Options.KeepTextsTogether = false;
converter.Options.KeepImagesTogether = false;
converter.Options.JavaScriptEnabled = true;
var pdf = converter.ConvertHtmlString(html, Request.Url.Scheme + "://" + Request.Url.Authority +
Request.ApplicationPath.TrimEnd('/') + "/");
pdf.Save(filePath);
我的CSS是在內容/的site.css 拿到HTML,我只是用$( 「#的PrintPage」)HTML()。然後通過Scripts/xx/custom/common.js上的ajax調用將其傳遞給控制器。問題是它看起來不像它在瀏覽器上那樣。沒有css被加載。我如何使用select.htmltopdf來呈現css呢?或者如果有其他可用的軟件包可以做同樣的事情。由於