I cant find an example where I can learn how to, in a mvc controller method:
1. create new pdf file, add som data
2. return it to browser as downloadable file
I can create the pdf from your example, but what next in the mvc controller method?
Code: C#
public ActionResult GetPdf() {
//Create a new document
PdfDocument doc = new PdfDocument();
//Create a new render
AcmRender render = new AcmRender(doc);
//Create some contents
AcmContent content = new AcmContent(new AcmText("Hello!"));
//Render the content
render.Render(content);
//Instead of saving the document to a local file, here it
//saves the document to output stream of the current
//HttpResponse object. It also set the content type as
//"application/pdf"
HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ClearHeaders();
response.ContentType = "application/pdf";
doc.Save(response.OutputStream);
return File.....() // what???
}
Pls, give us better examples how to use this, on MVC
// Hazze