当我更改源 HTML 后,WkHtmlToXSharp 不会立即渲染 HTML 元素
我已经下载了 WkHtmlToXSharp (它在幕后使用 WkHtmlToPdf)并打开了解决方案。 当我运行项目 CanConvertFromFile 给出的测试时,它给了我一个格式良好的 PDF 输出。
但是,一旦我从源 HTML 文件 (WkHtmlToXSharp.Tests\Resources\page.xhtml) 中删除空白,它就会仅呈现没有 HTML 结构的文本,即页面上的所有文本都呈现为单行。
我在使用 WkHtmlToXSharp 的开发项目中发现了同样的问题。
我怀疑这是由于源文件的字符编码发生了变化。你知道字符编码应该是什么吗?这也是 WkHtmlToPdf 的问题吗?
注意:对于稍有误导性的标签(WkHtmlToPdf)表示抱歉,该网站不允许我创建标签 WkHtmlToXSharp。
非常感谢!
I have downloaded WkHtmlToXSharp (which uses WkHtmlToPdf under the hood) and opened the solution.
When I run the test given with the project - CanConvertFromFile, it gives me a nicely formatted PDF output.
But as soon as I delete even a blank space from the source HTML file ( WkHtmlToXSharp.Tests\Resources\page.xhtml) it renders only text with no HTML structure in place i.e. all text on the page is rendered as a single line.
I am finding the same problem with my dev project using WkHtmlToXSharp.
I suspect this is due to change of character encoding of the source file. Do you know what the character encoding should be? Is this an issue with WkHtmlToPdf as well?
Note: Sorry for the slightly misleading tag (WkHtmlToPdf), the site did not allow me to create tag WkHtmlToXSharp.
Many Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
wkhtmltopdf 假定 UTF8 作为默认值,但有一个属性 (WebSettings.DefaultEncoding) 可用于覆盖预期的编码。
但是,您的问题看起来更像是您正在重新使用已处置的实例或类似的东西。您可以更深入地描述您的用例吗?它是 ASP.NET 应用程序吗?控制台项目?你在 Visual Studio 的开发网络服务器下运行吗?
wkhtmltopdf assumes UTF8 as default, but there's a property (WebSettings.DefaultEncoding) which can be used to override the encoding expected.
However, your problem looks more like you are re-using a disposed instance or something similar. May you describe a bit deeper your use case.. is it an ASP.NET application? a console project? are you running under visual studio's dev web server?
我相信造成这种情况的原因在于 Pablo 仓库的问题跟踪器中。 问题#7:仅第一次有效
I believe the cause of this is in the issue tracker on Pablo's repo. Issue #7: Only works first time