簡體   English   中英

使用ABCpdf工具將HTML轉換為PDF

[英]HTML to PDF convertion using ABCpdf tool

我正在嘗試使用ABCpdf組件將HTML頁面轉換為PDF。 我已經使用AddImagehtml方法來做到這一點。 這是工作。 我的要求是動態獲取值。 如何將值從數據集中傳遞到HTML。 誰能解決我的問題?

在stringbuilder中動態生成HTML

下面的偽代碼

String Builder SB = new StringBuilder()
// Initialize HTML here with head body, etc 
SB.AppendLine("<table>");`
foreach datarow DR in DataTable`
{
// loop through columns and add them in TR TD tags
}
// Now build the PDF from the HTML
Doc thisPDF = New Doc();
Integer iChk = thisPDF.AddImageHtml(SB.ToString());
while thisPDF.Chainable(iChk)
{
thisPDF.Page = thisPDF.AddPage();
thisPDF.FrameRect();
 iChk = thisPDF.AddImageToChain(iChk);
}
// Save the PDF here, or output to HTTP stream for user to download

我認為您應該使用其他方法(例如創建動態表和遍歷數據集以添加值)在服務器端動態進行此操作。

檢查安裝文件夾中ABC PDF文檔中的小表示例和大表示例。

暫無
暫無

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

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