我正在尝试使用 TuesPechkin 生成文档,到目前为止,它在 URL 图像方面工作得完美无缺。但是,当涉及到本地图像时,它似乎根本不会生成图像,如下所示:
文件生成:
public static void ConvertDoc(String html)
{
var document = new HtmlToPdfDocument
{
GlobalSettings =
{
ProduceOutline = true,
DocumentTitle = "Form documents",
Margins =
{
Top = 1.8,
Left = 2.5,
Right = 2.5,
Bottom = 2.5,
Unit = Unit.Centimeters
}
},
Objects =
{
new ObjectSettings { HtmlText = html,
WebSettings = new WebSettings() {
LoadImages = true
}
}
}
};
IConverter converter = new ThreadSafeConverter(
new PdfToolset(
new Win32EmbeddedDeployment(
new TempFolderDeployment())));
byte[] result = converter.Convert(document);
File.WriteAllBytes("C:/Users/jmann_000/Desktop/Test/program-test-2015.pdf", result);
}
}
}
如上所示,我还尝试将加载图像设置为 true,但没有成功。有问题的HTML:
<td>
<table border="0" cellpadding="0" cellspacing="0" class="doc-header">
<tr>
<td width="300" align="left"><img src="img/logo.gif" width="240" alt="AeroCare"></td>
<td width="375"></td>
</tr>
</table>
</td>
如果是本地图像,是否有正确的方法来生成图像?