2012-03-05 129 views
0

我想要使用ABCpdf组件将HTML页面转换为PDF。我已经使用AddImagehtml方法来做到这一点。这是工作。我的要求是动态获取值。我怎样才能将我的数据集中的值传递给HTML。 任何人都可以解决我的问题吗?HTML to PDF转换使用ABCpdf工具

回答

0

我认为你应该在服务器端动态地使用其他方法来创建一个动态表并循环你的数据集来添加值。

检查安装文件夹中ABC PDF文档中的小表示例和大表示例。

1

在stringbuilder E.g.中动态构建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