图像不会被渲染为在 .net core 5 的 SelectPdf 库中提供外部基本 URL
[HttpGet()]
public IActionResult GetDocket()
{
HtmlToPdf htmlToPdf = new HtmlToPdf();
htmlToPdf.Options.PdfPageOrientation = PdfPageOrientation.Portrait;
htmlToPdf.Options.PdfPageSize = PdfPageSize.A4;
htmlToPdf.Options.CssMediaType = HtmlToPdfCssMediaType.Print;
htmlToPdf.Options.InternalLinksEnabled = true;
htmlToPdf.Options.ExternalLinksEnabled = true;
string html = "";
html += "<div style='background-colour:#edf3f3'>";
html += "<img src='/images/logo.svg' alt='BaseURLHomeLogo'";
html += "</div>";
PdfDocument pdfDocument = htmlToPdf.ConvertHtmlString(html, "https://xyz.home.com");
byte[] pdf = pdfDocument.Save();
return new FileContentResult(pdf, "application/octet-stream")
{
FileDownloadName = "Print.pdf"
};
}
是否有任何选项可以将背景默认颜色设置为#edf3f3,内容结束后显示空白。