【发布时间】:2011-06-09 13:15:00
【问题描述】:
我正在为 wkhtmltopdf 转换器使用WkHtmlToXSharp 包装器。提供的 html 中的文本已成功显示在生成的 pdf 中。但是没有显示图像。然后我将相对图像路径更改为绝对路径:
但这仍然不起作用。
我的方法是:
public static string ConvertToPdf(string htmlContent,string pdfName)
{
WkHtmlToPdfConverter w = new WkHtmlToPdfConverter();
byte[] str= w.Convert(htmlContent);
string pdfUrl = HttpContext.Current.Server.MapPath("~/utils/PDF/"+pdfName);
File.WriteAllBytes(pdfUrl, str);
w.Dispose();
return pdfUrl;
}
这段代码有什么不足吗?请问有什么办法吗?
【问题讨论】:
标签: c# wkhtmltopdf html-to-pdf