首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过NReco PDF生成器生成PDF时出错

通过NReco PDF生成器生成PDF时出错
EN

Stack Overflow用户
提问于 2019-09-09 18:13:22
回答 1查看 1.5K关注 0票数 0

我正在测试NReco PDF生成器,以从C#代码生成PDF文件。到目前为止,这个组件运行得很好,但是今天我在生成PDF时记录了一个异常:

代码语言:javascript
复制
System.Exception: Cannot generate PDF:  (exit code: -1073741628)
 ---> NReco.PdfGenerator.WkHtmlToPdfException:  (exit code: -1073741628)
   at NReco.PdfGenerator.HtmlToPdfConverter.CheckExitCode(Int32 exitCode, String lastErrLine, Boolean outputNotEmpty)
   at NReco.PdfGenerator.HtmlToPdfConverter.InvokeWkHtmlToPdf(PdfSettings pdfSettings, String inputContent, Stream outputStream)
   at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdfInternal(WkHtmlInput[] htmlFiles, String inputContent, String coverHtml, String outputPdfFilePath, Stream outputStream)
   --- End of inner exception stack trace ---
   at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdfInternal(WkHtmlInput[] htmlFiles, String inputContent, String coverHtml, String outputPdfFilePath, Stream outputStream)
   at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdf(String htmlContent, String coverHtml, Stream output)
   at NReco.PdfGenerator.HtmlToPdfConverter.GeneratePdf(String htmlContent, String coverHtml)

有人知道这是什么原因,或者我如何调试它?

EN

回答 1

Stack Overflow用户

发布于 2019-09-12 08:02:25

当您看到奇怪的退出代码(如exit code: -1073741628 )时,这意味着wkhtmltopdf进程由于某种原因而被压碎。要获得更多详细信息,您可以:

  • 处理"LogReceived“事件并获得完整的wkhtmltopdf控制台日志输出;它通常包含有助于理解为什么HTML呈现失败的消息。
  • 通过为HTML输入运行wkhtmltopdf从命令行执行PDF生成

Wkhtmltopdf有一些已知的问题尚未解决,可能会导致进程崩溃;这可能是:超出页面尺寸的页脚内容太长;元素与边框半径的特定组合;特定的js代码。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57859211

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档