2016-06-07 4 views
0

Ich versuche, ein PDF aus einigen Eingabedaten zu generieren. Also habe ich meine PDFGenerator() und das schafft eine pdf mit etwas Text:Aspose.pdf gibt weiße Seiten zurück

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

aber ich bekomme nur ein weißes ausgelagerten pdf, any:

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); 
    } 
} 

aus meiner Httppost-Methode aufgerufen wird Idee, warum ich falsch mache?

Antwort

0

Das Problem war nicht der Code .Net, es auf meinem Client war, ich hinzufügen benötigt:

{responseType:'arraybuffer'} 

auf meinem http Anfrage (Javascript)