TuesPechkin 无法加载 DLL 'wkhtmltox.dll' [英] TuesPechkin unable to load DLL 'wkhtmltox.dll'

查看:50
本文介绍了TuesPechkin 无法加载 DLL 'wkhtmltox.dll'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 TuesPechkin 有一段时间了,今天我去将 nuget 包更新到新版本 2.0.0+ 并注意到 Factory.Create() 不再解决,所以我去 GitHub 上阅读所做的更改并注意到它现在需要 dll 的路径?

I've been using TuesPechkin for some time now and today I went to update the nuget package to the new version 2.0.0+ and noticed that Factory.Create() no longer resolved, so I went to read on the GitHub the changes made and noticed it now expects the path to the dll?

IConverter converter =
    new ThreadSafeConverter(
        new PdfToolset(
            new StaticDeployment(DLL_FOLDER_PATH)));

在过去的几个小时里,我尝试了几乎所有我能想到的路径,in"、app_data"、app_start"等,但我似乎无法找到或弄清楚它是什么想要路径和什么dll?

For the past few hours I've tried almost all the paths I can think of, "in", "app_data", "app_start", etc and I can't seem to find or figure out what it wants for the path and what dll?

我可以在 bin 文件夹中看到 TuesPechkin dll,这是我尝试的第一个路径,但出现以下错误:

I can see the TuesPechkin dll in my bin folder and it was the first path I tried, but I got the following error:

附加信息:无法加载 DLL 'wkhtmltox.dll':找不到指定的模块.(HRESULT 的例外:0x8007007E)

Additional information: Unable to load DLL 'wkhtmltox.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

那个 dll 在哪里,现在我可以得到它,因为库似乎不包含它,我尝试安装 TuesPechkin.Wkhtmltox.Win32 包,但仍然找不到 dll.此外,我在 asp.net 网站项目中使用它,所以我认为使用以下内容应该可以用于获取路径,对吗?

Where is that dll and now can I get it as the library doesn't seem to contain it, I tried installing the TuesPechkin.Wkhtmltox.Win32 package but the dll still is nowhere to be found. Also I am using this in a asp.net website project so I assume that using the following should work for obtaining the path, right?

var path = HttpContext.Current.Server.MapPath(@"~inTuesPechkin.dll");

更多信息:https://github.com/tuespetre/TuesPechkin/issues/57

推荐答案

Tuespechkin 有一个 zip 文件作为wkhtmltox.dll"文件的 Win32 和 Win64 嵌入包中的资源.

The Tuespechkin has a zip file as a resource in the Win32 and Win64 embedded packages for the 'wkhtmltox.dll' file.

当您使用 Win32 或 Win64 Embedded 软件包时,它会解压缩文件并将其放在您指定的目录中.

What it does when you use the Win32 or Win64 Embedded package is unzips the file and places it in the directory that you specify.

我已经将 wkhtmltox dll 的副本放在我的 Web 应用程序目录的根部分,并使用我的 Web 应用程序的服务器物理路径将 DLL_FOLDER_PATH 指向它.

I have been putting a copy of the wkhtmltox dll at the root portion of my web app directory and pointing the DLL_FOLDER_PATH to it using the server physical path of my web app to get to it.

根据作者的说法,您必须将转换器设置在静态字段中才能获得最佳效果.

According to the author, you must set the converter in a static field for best results.

我这样做了,但是在我使用完转换器后将转换器设置为 null,这似乎有效.

I do that, but set the converter to null when I am finished using it, and that seems to work.

Tuespechkin 是 wmkhtmlox dll 文件的包装器.

Tuespechkin is wrapper for the wmkhtmlox dll file.

原始文件是用 C++ 编写的,因此不会自动在 C# 或 VB.NET 或任何其他托管代码域中使用.

The original file is written in C++ and so will not automatically be usable in C# or VB.NET or any of the other managed code domains.

Tuespechkin.dll 文件不包含wkhtmltox.dll"的副本.您要么必须使用其他嵌入式部署模块之一,要么在从 Internet 下载后在您的 Web 应用程序中安装wkhtmltox.dll"的副本.这就是我所做的,它似乎工作得很好.

The Tuespechkin.dll file DOES NOT contain a copy of 'wkhtmltox.dll'. You either have to use one of the other embedded deployment modules or install a copy of the 'wkhtmltox.dll' in your web app after downloading it from the internet. That is what I do, and it seems to work just fine.

我正在使用 Team Foundation Server,在使用 Tuespechkin 例程后尝试编译代码将在第一次失败,因为 'wkhtmltox.dll' 文件被锁定,但您所要做的只是重试构建,它会通过.

I am using Team Foundation Server, and attempts to compile code after using the Tuespechkin routines will fail the first time because the 'wkhtmltox.dll' file gets locked, but all you have to do is simply retry your build and it will go through.

我遇到了 32 位例程无法在 64 位环境中工作以及 64 位环境无法在本地主机上测试的问题.在检查了 Tuespechkin 以及 Win32 和 Win64 嵌入式部署包的源代码后,我采用了我想出的解决方法.

I had issues with the 32-bit routine not working in a 64-bit environment and the 64-bit environment not being testable on localhost. I went with the workaround I came up with after examining the source code for Tuespechkin and the Win32 and Win64 embedded deployment packages.

只要您为输入指定 url 而不是原始 html,它就可以正常工作.

It works well as long as you specify a url for the input rather than raw html.

旧包不能很好地呈现 css.

The older package didn't render css very well.

如果您使用的是 print.aspx 例程,您可以为其创建 url 作为主 url 的偏移量.

If you are using a print.aspx routine, you can create the url for it as an offset from your main url.

此时我没有与我一起使用的源代码来抵消您的 Web 应用程序的基本 url,但这只是 HttpRequest 的一个分支.

I don't have the source code I am using with me at this point to offset to your base url for your web application, but it is simply an offshoot of HttpRequest.

您必须使用物理路径来查找 .dll,但您可以使用 Web 路径来查找打印例程.

You have to use the physical path to find the .dll, but you can use a web path for the print routine.

我希望这能稍微回答您的问题.

I hope this answers your question a bit.

这篇关于TuesPechkin 无法加载 DLL 'wkhtmltox.dll'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆