簡體   English   中英

將HTML保存到Pdf ABCPdf 4

[英]Save HTML to Pdf ABCPdf 4

我正在使用以下代碼將html保存為pdf文件。 但是它在if(!theDoc.Chainable(theID))處無法編譯。 我確實使用過WebSupergoo.ABCpdf4; 在代碼開頭添加。 是這個版本嗎? 還有其他方法可以將HTML字符串保存到ABCPdf 4中的pdf文件中。

錯誤消息為“'WebSupergoo.ABCpdf4.Doc'不包含'Chainable'的定義,並且找不到擴展方法'Chainable'接受類型為'WebSupergoo.ABCpdf4.Doc'的第一個參數(您是否缺少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();

感謝所有幫助。

我修好了 以下是將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();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM