开发者

WkHtmlToXSharp not rendering HTML elements as soon as I change the source HTML

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开发者_StackOverflow中文版 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!


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?


I believe the cause of this is in the issue tracker on Pablo's repo. Issue #7: Only works first time

datimson commented 25 days ago
Also, for the sake of helping anyone else who might have this problem, when debugging with WkHtmlToXSharp in ASP.NET you need to stop the ASP Development server before restarting or rebuilding the application - this is what was causing my text only PDF outputs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜