2016-06-07 37 views
0

我试图从某些输入数据生成pdf。 所以我创造了我的pdfGenerator(),并创建了一些文本的PDF:Aspose.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,任何想法为什么我做错了?

回答

0

的问题是不是Net代码,这是我的客户,我需要添加:

{responseType:'arraybuffer'} 

我的http请求(JavaScript)的