I use the WkHtmlToXSharp wrapper library in my project to create a PDF file from HTML.
I used this library many times on different computers, and suddenly I came across the following problem:
System.AccessViolationException: Attempted to read or write protected memory. This often indicates that another memory is corrupted. in WkHtmlToXSharp.WkHtmlToPdfConverter.wkhtmltopdf_convert (IntPtr converter) in WkHtmlToXSharp.WkHtmlToPdfConverter.Convert (String inputHtml) in WkHtmlToConTonTonTonTonTonFtftTtPtFTPtft Threading.DelegateQueue.EndInvoke (result of IAsyncResult) in Sanford.Threading.DelegateQueue.Invoke (Delegate method, Object [] args) on WkHtmlToXSharp.MultiplexingConverter.Convert ()
This is apparently a common problem with this library (I found some reviews on the Internet about this, but there were no fixes). By the way, in my case this happens somewhat randomly. I have not experienced this problem in other dev machines. I wonder if anyone has a fix. I also wonder if this is a problem with the wrapper library, if with the WkHtmlToPDF library itself.
Any suggestion? I am also open to using another converter if it is free and stable, and, if possible, does not spawn a new process. It should work correctly and stably in all versions of Windows and perform a decent conversion of work (the HTML that needs to be converted is fixed - contains several photos and tables and basic CSS).
source share