简体   繁体   中英

unable to resolve 'SynchronizedConverter' in dot net core 2.0 web app when using dinkToPdf

I am trying to integrate DinkToPdf dot net core wrapper to an existing dot net core 2.0 web app following the instructions on GitHub. But IConverter/SynchronizedConverter/PdfTools are not getting resolved. Guess I am missing a using statement but cannot determine what..

This is what I have done ..

  1. Used .nuget to install DinkToPdf. The package was successfully installed to users/userprofile/.nuget/.. /dinktopdf folder

  2. downloaded the 64 bit dll's from github (rdvojmoc/DinkToPdf/v0.12.4/64 bit/) to the project folder

  3. updated the startup.cs ConfigureServices() method by adding services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));

at which point I get the errors with " are you missing a using .. "

I also tried the following, and verified that the path as well as LoadUnmanagedLibrary() are successful.

public void ConfigureServices(IServiceCollection services) { var context = new CustomAssemblyLoadContext(); context.LoadUnmanagedLibrary(Path.Combine(Directory.GetCurrentDirectory(), "libwkhtmltox.dll"));

services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));

}

What is it that I am missing .. thanks for any assistance.

resolved. Restarting visual studio fixed the issue. May be a caching issue, would like a better reason if possible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM