【问题标题】:Save HTML to Pdf ABCPdf 4将 HTML 保存为 PDF ABCPdf 4
【发布时间】:2009-09-28 21:28:26
【问题描述】:

我正在使用以下代码将 html 保存为 pdf 文件。但它无法编译 如果(!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();

感谢所有帮助。

【问题讨论】:

    标签: abcpdf


    【解决方案1】:

    我解决了这个问题。以下是将html字符串保存为pdf的代码。

    Doc theDoc = new Doc(); 
    theDoc.Rect.Inset(10, 50); 
    theDoc.Page = theDoc.AddPage(); 
    int theID; 
    theID = theDoc.AddImageHtml(str); 
    while (true) 
    { 
       if (theDoc.GetInfo(theID, "Truncated") != "1") 
        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();
    

    【讨论】:

      猜你喜欢
      • 2012-05-09
      • 1970-01-01
      • 2017-01-14
      • 2012-03-22
      • 2011-02-14
      • 1970-01-01
      • 2017-05-27
      • 2012-07-02
      • 2010-09-22
      相关资源
      最近更新 更多