gpt4 book ai didi

c# - 找不到 DinkToPdf dll libwkhtmltox

转载 作者:行者123 更新时间:2023-12-05 08:37:07 53 4
gpt4 key购买 nike

我正在开发 .net5.0 网络 API,但在使用 DinkToPdf 时出现以下错误:

DllNotFoundException: Unable to load DLL 'libwkhtmltox' or one of its dependencies: The specified module could not be found. (0x8007007E)

我关注了this教程,但有一些异常(exception):

  • added the service 添加了服务,教程中没有做到

    services.AddSingleton(typeof(IConverter),
    new SynchronizedConverter(new PdfTools()));
    ...
    services.AddScoped<IPdfService, PdfService>();
  • 以不同方式命名服务,但这无关紧要

  • 通过 NuGet 而不是 Install-Package DinkToPdf

    安装它
  • 我的项目只是一个 API,前端不是在 C# 中,应该无关紧要,因为错误在这里:

    return this._converter.Convert(htmlToPdfDocument);

按照教程中的方式完成其他所有操作。

最佳答案

对我而言,将其添加到 csproj 文件中解决了问题 -

<ItemGroup>
<None Remove="libwkhtmltox.dll" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="libwkhtmltox.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>

关于c# - 找不到 DinkToPdf dll libwkhtmltox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66818105/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com