lundi 11 janvier 2016

MVCRazorToPDF Adding page header and footer on every pages

Can i make a header and footer on every pages created using MVCRazorToPDF Library On PDFLayout.cshtml file i am making a section for the body of PDF as

<body>
@RenderBody()
</body>

And in controller i am calling the action like

return new PdfActionResult(model, (writer, document) =>
        {
            document.SetPageSize(new Rectangle(233, 842, 90));
            document.NewPage();
        });

And my View.cshtml is like a normla html page

@model PDFLAbApp.Models.PdfExample
@{
    Layout = "~/Views/Shared/_PdfLayout.cshtml";
}
<h1>@Model.Heading</h1>
<p>
paragraph content repeated n times based on the model content [ its a foreach loop and page size is more than 2 
</p>

Aucun commentaire:

Enregistrer un commentaire