Reputation: 140
The Image is not be render as giving the external base url in the SelectPdf Library in the .net core 5
[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"
};
}
Is there any options to set the background default color to #edf3f3, It is showing the white space after the content is over.
Upvotes: 0
Views: 791
Reputation: 140
I have switched to another plugin. Explored with WkHtmlToPdf-DotNet, Now it is working well.
https://github.com/HakanL/WkHtmlToPdf-DotNet
SelectPdf was just time waster.
Upvotes: 0