public async Task <IActionResult> BuildPDF([FromServices] INodeServices nodeServices, [FromBody] PDFRequest rawdata) { JObject options = JObject.Parse(rawdata.options); JSONResponse result = null; //var options = new { format="letter", orientation= "portrait" }; // execute the Node.js component to generate a PDF result = await nodeServices.InvokeAsync <JSONResponse>("./pdf.js", rawdata.html, options); return(new FileContentResult(result.data, "application/pdf")); }
public async Task <IActionResult> BuildPDF([FromServices] INodeServices nodeServices, [FromBody] PDFRequest rawdata) { //JObject options = JObject.Parse(rawdata.options); // execute the Node.js component to generate a PDF JSONResponse result = await nodeServices.InvokeAsync <JSONResponse>("./pdf", rawdata.html, JObject.Parse(rawdata.options)); //options = null; return(new FileContentResult(result.data, "application/pdf")); }