我正在使用以下代码将 html 保存为 pdf 文件。但它无法在 if (!theDoc.Chainable(theID)) 处编译。我确实使用过 WebSupergoo.ABCpdf4;在代码开头添加。是这个版本的问题吗?有没有其他方法可以将 HTML 字符串保存到 ABCPdf 4 中的 pdf 文件。
错误消息是“‘WebSupergoo.ABCpdf4.Doc’不包含‘Chainable’的定义,并且找不到接受‘WebSupergoo.ABCpdf4.Doc’类型的第一个参数的扩展方法‘Chainable’(您是否缺少 using 指令还是汇编参考?)
Doc theDoc = new Doc();
theDoc.Rect.Inset(10, 50);
theDoc.Page = theDoc.AddPage();
int theID;
theID = theDoc.AddImageHtml(str);
while (true)
{
if (!theDoc.Chainable(theID))
break;
theDoc.Page = theDoc.AddPage();
theID = theDoc.AddImageToChain(theID);
}
for (int i = 1; i <= theDoc.PageCount; i++)
{
theDoc.PageNumber = i;
theDoc.Flatten();
}
theDoc.Save("path where u want 2 save" + ".pdf");
theDoc.Clear();
感谢所有帮助。