Nreco pdf 生成器:由于网络错误退出代码 1:RemoteHostClosedError [英] Nreco pdf generator: Exit with code 1 due to network error: RemoteHostClosedError

查看:217
本文介绍了Nreco pdf 生成器:由于网络错误退出代码 1:RemoteHostClosedError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 nreco.pdfgeneratorhtml 转换为 pdf 格式.目前面临一个问题,即 pdf 生成器工具在其他环境中托管时生成 pdf 时抛出异常.错误如下:

Am using nreco.pdfgenerator to convert html into pdf format. Currently am facing an issue where pdf generator tool is throwing an exception while generating the pdf when hosted in other environments. The error as follows:

NReco.PdfGenerator.WkHtmlToPdfException:由于网络错误退出代码 1:RemoteHostClosedError(退出代码:1)

NReco.PdfGenerator.WkHtmlToPdfException: Exit with code 1 due to network error: RemoteHostClosedError (exit code: 1)

我已授予文件夹和文件所需的所有权限.不确定这个网络错误.有人可以调查一下吗?
谢谢

I have given all the required permissions to the folders and files. Not sure about this network error. Can someone look into it ?
Thanks

推荐答案

NReco PdfGenerator 是 wkhtmltopdf 工具的 .NET 包装器,此异常意味着 wkhtmltopdf 进程退出并显示错误代码,并且最后一条错误消息(来自控制台日志)是由于网络错误以代码 1 退出:RemoteHostClosedError".

NReco PdfGenerator is a .NET wrapper for wkhtmltopdf tool, and this exception means that wkhtmltopdf process exited with error code, and last error message (from console log) was "Exit with code 1 due to network error: RemoteHostClosedError".

此错误意味着 HTML 文档引用了外部资源(图像、css、js 等),并且由于某些原因 wkhtmltopdf 无法访问它们.确保 URL 正确(如果您提供 HTML 作为 C# 字符串,则所有 URL 都应该是绝对的),并且执行 wkhtmltopdf 的服务器可以下载这些 URL.

This error means that HTML document has references to external resources (images, css, js etc) and for some reason they cannot be accessed by wkhtmltopdf. Ensure that URLs are correct (if you provide HTML as C# string, all URLs should be absolute), and server where wkhtmltopdf is executed can download these URLs.

这篇关于Nreco pdf 生成器:由于网络错误退出代码 1:RemoteHostClosedError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆