我正在尝试创建一个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;
}