我正在尝试从一些输入数据生成一个pdf。所以我创建了我的PdfGenerator(),它创建了一个包含一些文本的pdf:
public class PdfGenerator {
public PdfGenerator() {
//Instantiate License class and call its SetLicense method to use the license
var license = new Aspose.Pdf.License();
license.SetLicense("Aspose.Total.lic");
}
public void Generate(Generation input) {
//Create pdf document
var pdf1 = new Pdf();
//Add a section into the pdf document
var sec1 = pdf1.Sections.Add();
//Add a text paragraph into the section
sec1.Paragraphs.Add(new Text("Hello World"));
//Save the document
pdf1.Save(input.Reference + ".pdf", SaveType.OpenInBrowser, HttpContext.Current.Response);
}
}这是从我的HttpPost方法中调用的:
// POST api/values
[System.Web.Http.HttpPost]
public void Post([FromBody]Generation value) {
_pdfGenerator.Generate(value);
}但是我只得到了一个白色页面的pdf,你知道我为什么做错了吗?
发布于 2016-06-07 20:48:06
问题不是.Net代码,而是我的客户端,我需要补充一下:
{responseType:'arraybuffer'}在我的http请求(javascript)上
https://stackoverflow.com/questions/37678719
复制相似问题