如何使用带角度js的WebAPI创建PDF

时间:2015-12-14 12:29:32

标签: angularjs api model-view-controller web

我的API方法:

var stream = PdfUtility.PdfGenaration.GenaratePdfWithStream(body);
above will return bytes.
 HttpResponseMessage result1 = new HttpResponseMessage();
 result1.Content = new ByteArrayContent(stream);
 result1.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
 result1.Content.Headers.ContentDisposition.FileName = "TEST";
 result1.Content.Headers.ContentType = new MediaTypeHeaderValue("application/pdf");

 return result1;

任何角色代码

 var file = new Blob([data], { type: "application/pdf" });
            saveAs(file, "test.pdf");

我得到空的pdf.Any一个帮助。

0 个答案:

没有答案