简体   繁体   English

Tuesspechkin 找不到 wkhtmltox.dll

[英]Tuespechkin cannot find wkhtmltox.dll

Good morning,早上好,

I'm trying to generate pdf files with Tuespechkin, using html.我正在尝试使用 html 与 Tuesspechkin 生成 pdf 文件。 It works perfectly locally, however not in production.它在本地完美运行,但在生产中却不行。

    public static bool GeneratePDFFromHTMLPaysage(String full_path, String htmlContent, String baseUrl)
    {
        try
        {
            String content = "<!DOCTYPE html><html><head><meta http-equiv='X-UA-Compatible' content='IE=edge'><meta charset='UTF-8' name='viewport' content='width=device-width, initial-scale=1'><title>Titre</title><link rel='stylesheet' type='text/css' href='https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css'><script type='text/javascript' src='https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js'></script></head><body><div class='container'>";

            content = content + htmlContent;
            content = content + "</div></body></html>";
            full_path = full_path + ".pdf";

            var document = new HtmlToPdfDocument
            {
                GlobalSettings =
                {
                    ProduceOutline = true,
                    PaperSize = System.Drawing.Printing.PaperKind.A4, // Implicit conversion to PechkinPaperSize
                    Margins =
                    {
                        All = 0,
                        Unit = Unit.Centimeters
                    },
                    Orientation = GlobalSettings.PaperOrientation.Landscape
                },
                Objects = {
                    new ObjectSettings { HtmlText = content }
                }
            };
            IConverter convert = new StandardConverter(
                new PdfToolset(
                    new Win64EmbeddedDeployment(
                        new TempFolderDeployment())));
            byte[] test = convert.Convert(document);
            System.IO.File.WriteAllBytes(full_path, test);
            return true;
        }
        catch (Exception e)
        {
            ErrorManager.Log(e.Message + "\n" + e.InnerException + "\n" + e.StackTrace);
            return false;
        }
    }

Basically, I tried to replace 64 bits with 32 bits, specified a static path for deployment as advised in documentation (doing so create a folder in which the missing DLL is placed, it has the same behavior in local than in production, but only work locally).基本上,我尝试用 32 位替换 64 位,按照文档中的建议指定 static 部署路径(这样做创建一个文件夹,其中放置缺少的 DLL,它在本地的行为与在生产中的行为相同,但只能工作本地)。

my application is a basic windows application, I simply copy files from Debug or Release folder to deploy it:我的应用程序是一个基本的 windows 应用程序,我只需从 Debug 或 Release 文件夹复制文件来部署它:

该项目

as you can see, I included wkhtmltox.dll so it automaticaly deploy in the root folder of the project, but no results as well如您所见,我将 wkhtmltox.dll 包含在内,因此它会自动部署在项目的根文件夹中,但也没有结果

**Summary: ** .NET 4 framework, windows application, trying to use Tuespechkin, had installated visual C++ 2013 on production trying to solve missing dll, and a lot of stuff with the code **Summary: ** .NET 4 framework, windows application, trying to use Tuespechkin, had installated visual C++ 2013 on production trying to solve missing dll, and a lot of stuff with the code

Thanks for your attention, hoping for a solution感谢您的关注,希望有解决方案

Well, seems like my production server is just too old (windows server 2003), and that it might explain the problem好吧,好像我的生产服务器太旧了(windows server 2003),它可能解释了这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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