【发布时间】:2021-02-21 22:24:58
【问题描述】:
我正在尝试按照 GitHub 上的说明将 DinkToPdf 点网核心包装器集成到现有的点网核心 2.0 Web 应用程序中。但是 IConverter/SynchronizedConverter/PdfTools 没有得到解决。猜猜我错过了一个 using 语句,但无法确定是什么..
这就是我所做的..
-
使用 .nuget 安装 DinkToPdf。 包成功安装到 users/userprofile/.nuget/.. /dinktopdf 文件夹
-
从 github (rdvojmoc/DinkToPdf/v0.12.4/64 bit/) 下载 64 位 dll 到项目文件夹
-
通过添加 services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools())); 更新了 startup.cs ConfigureServices() 方法;
此时我收到“您是否缺少 using ..”的错误
我也尝试了以下,验证了路径和LoadUnmanagedLibrary()都成功了。
public void ConfigureServices(IServiceCollection 服务) { var context = new CustomAssemblyLoadContext(); context.LoadUnmanagedLibrary(Path.Combine(Directory.GetCurrentDirectory(), "libwkhtmltox.dll"));
services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools()));
}
我错过了什么......感谢您的帮助。
【问题讨论】: