【问题标题】:HTML to PDF convertion using ABCpdf tool使用 ABCpdf 工具将 HTML 转换为 PDF
【发布时间】:2012-03-22 16:08:40
【问题描述】:

我正在尝试使用 ABCpdf 组件将 HTML 页面转换为 PDF。我已经使用 AddImagehtml 方法来做到这一点。这是工作。我的要求是动态获取值。如何将值从我的数据集传递到 HTML。 谁能解决我的问题?

【问题讨论】:

    标签: .net pdf abcpdf


    【解决方案1】:

    在字符串生成器中动态构建 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
    

    【讨论】:

      【解决方案2】:

      我认为您应该使用其他方法在服务器端动态执行此操作,例如创建动态表并循环遍历数据集以添加值。

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

      【讨论】:

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