2016-06-07 8 views
0

일부 입력 데이터에서 pdf를 생성하려고합니다. 그래서 난 내 PdfGenerator()를 생성하고 몇 가지 텍스트로 PDF 생성이 내 HttpPost 메서드에서 호출되는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); 
    } 
} 

을 :

// POST api/values 
    [System.Web.Http.HttpPost] 
    public void Post([FromBody]Generation value) { 
     _pdfGenerator.Generate(value); 
    } 

하지만 난 단지, 어떤 흰색 페이지 된 PDF를 얻을 수 내가 왜 잘못하고 있는거야?

답변

0

이 문제는 내 클라이언트이고, 닷넷 코드 아니었다, 내가 추가 할 필요 :

{responseType:'arraybuffer'} 

을 내 HTTP 요청에 (자바 스크립트)