Azure函数错误无法加载DLL

时间:2018-07-20 06:21:50

标签: c# azure-functions html-to-pdf

问题

我正在尝试创建一个Azure函数以创建html到pdf。它在本地运行得非常好,但是当我将其部署到azure函数时,它让我错了

错误

  

无法加载DLL'libwkhtmltox'或其依赖项之一:找不到指定的模块。

代码

public static HttpResponseMessage Run([HttpTrigger(AuthorizationLevel.Function,"post", Route = null)]HttpRequest req, TraceWriter log)
    {
        log.Info("C# HTTP trigger HtmlToPdf processed a request.");

        //string name = req.Query["name"];

        string requestBody = new StreamReader(req.Body).ReadToEnd();
        dynamic data = JsonConvert.DeserializeObject<Body>(requestBody);

        var pdf = Pdf
            .From(data.Html)
            .Content();

        log.Info($"PDF Generated. Length={pdf.Length}");

        var res = new HttpResponseMessage(HttpStatusCode.OK);
        res.Content = new ByteArrayContent(pdf);
        res.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");
        res.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("inline");
        return res;
    }

0 个答案:

没有答案