Closed crmmvio closed 1 year ago
You need to only hold a singleton of the SynchronizedConverter.
In the Startup file already has
services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));
Then you should use that, instead of creating a new instance:
using (var converter = new SynchronizedConverter(new PdfTools()))
see above my code is exactly like this
Yes, that's what's wrong, you should NOT create a new instance, instead you should use the singleton.
You would have an example of correct use, this one I got from the git documentation
ok now i understand, use by IOC, tks!!
When I try to generate a pdf twice in a row the following error occurs:
Erro An unhandled exception of type 'System.AccessViolationException' occurred in WkHtmlToPdfDotNet.dll: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
` var htmlContent = await this.RenderViewAsync("PrintCoverSheet", viewModel, false);
`![Erro-WkHtmlToPdfDotNet](https://user-images.githubusercontent.com/2079957/210634055-462c6a06-10b5-4cb8-9671-1ecfc59741f8.png)