【问题标题】:Error using HTML to PDF conversion using Essential objects使用 Essential 对象将 HTML 转换为 PDF 时出错
【发布时间】:2014-09-11 08:28:01
【问题描述】:

我使用以下代码使用EO将html转换为pdf

 private void CreatePDFFromHtml(string strFilePath, string strFileExt)
        {
            string strGetFileName = System.IO.Path.GetFileName(strFilePath);
            string strFileLocation = txtTarget.Text + "\\" + strGetFileName.Replace(strFileExt, ".pdf");
            if (System.IO.File.Exists(strFileLocation))
            {
                File.Delete(strFileLocation);
            }
            HtmlToPdf.ConvertHtml(strGetFileName, strFileLocation);

        }

但是,我得到的输出在 pdf 文件中是完全空白的。 我已经使用 nuget install-package EO.pdf 安装了它

【问题讨论】:

  • 我用过.net framework 4。不知道为什么它不起作用,谁能指出解决方案?

标签: c# html pdf


【解决方案1】:

我终于找到了问题所在。在 HTMLToPDF.ConvertHtml(string html, pdfdocument) 的第一个参数中 我提供了 html 文件名,它需要的是字符串格式的实际 html。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-21
    • 1970-01-01
    相关资源
    最近更新 更多