如何生成pdf?我正在尝试节点服务,但它无法正常工作。我有visual studio 2015 Microsoft.NETCore.App:1.0.1
[HttpGet]
public async Task<IActionResult> Index([FromServices] INodeServices nodeServices)
{
HttpClient hc = new HttpClient();
var htmlContent = await hc.GetStringAsync($"http://{Request.Host}/report.html");
var result = await nodeServices.InvokeAsync<byte[]>("./pdf", htmlContent);
HttpContext.Response.ContentType = "application/pdf";
HttpContext.Response.Headers.Add("x-filename", "report.pdf");
HttpContext.Response.Headers.Add("Access-Control-Expose-Headers", "x-filename");
HttpContext.Response.Body.Write(result, 0, result.Length);
return new ContentResult();
}