samedi 22 août 2015

How to create new page in MvcRazorToPdf?

My code for generating pdf file is this:

public ActionResult Print(int id)
{
var record = db.Records.Find(id);
return new PdfActionResult(record, (writer, document) =>
{
    document.SetPageSize(new Rectangle(600f, 400f, 90));
    document.NewPage();
});

}

How to return a PdfActionResult with multiple pages for each record if i have a list of records? For example: public ActionResult Print(int id) { var records = db.Records.ToList();

// How to return pdfactionresult for each record?

return new PdfActionResult(record, (writer, document) =>
{
    document.SetPageSize(new Rectangle(600f, 400f, 90));
    document.NewPage();
});

}

Aucun commentaire:

Enregistrer un commentaire