

We recommend to update the file from time to time though


You can also use the same file across multiple versions of PDFCreator, as theĬOM interface does not change. This file will be copied to your build folder, but does not have anyĭependencies. You have to reference the file from the installation folder of Starting with PDFCreator 2.5.3, we have therefore created a Wrapper, that provides the sameĬlasses and methods as the original COM interface, but invokes them using dynamic calls. tlb file that is created when registering the COM interface, but again, The downside is that you will lose IntelliSense support this way. GetTypeFromProgID ( "PDFCreator.JobQueue" ) dynamic queue = Activator. In here, we are creating an instance of the CustomAssemblyLoadContext class and just call the LoadUnmanagedLibrary method with the path of the libwkhtmltox.dll file.Type queueType = Type. Services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools())) Var context = new CustomAssemblyLoadContext() Ĭontext.LoadUnmanagedLibrary(Path.Combine(Directory.GetCurrentDirectory(), "libwkhtmltox.dll")) Public void ConfigureServices(IServiceCollection services) Protected override Assembly Load(AssemblyName assemblyName)Īfter that, let’s modify the ConfigureServices method in the StartUp class: Return LoadUnmanagedDllFromPath(unmanagedDllName) Protected override IntPtr LoadUnmanagedDll(string unmanagedDllName) Public IntPtr LoadUnmanagedLibrary(string absolutePath) Let’s do that step by step.įirst, in the Utility folder we are going to add a new class CustomAssemblyLoadContext and modify it: internal class CustomAssemblyLoadContext : AssemblyLoadContext If we want to deploy this application, we have to make some changes. New Employee Įverything is working as it supposed to. NET/C# content and get paid? > JOIN US! GetAllEmployees() => Wanna join Code Maze Team, help us produce more awesome.
