我正在尝试使用 ABCpdf 组件将 HTML 页面转换为 PDF。我已经使用 AddImagehtml 方法来做到这一点。这是工作。我的要求是动态获取值。如何将值从我的数据集传递到 HTML。谁能解决我的问题?
问问题
1572 次
2 回答
1
在 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
于 2012-04-11T13:03:05.490 回答
0
我认为您应该使用其他方法在服务器端动态地执行此操作,例如创建动态表并遍历数据集以添加值。
检查安装文件夹中 ABC PDF 文档中的小表示例和大表示例。
于 2012-03-05T10:46:36.377 回答