2

我可以在 PDFLayout.cshtml 文件上使用 MVCrazorToPDF 库创建的每个页面上创建页眉和页脚吗?我正在为 PDF 正文创建一个部分

<body>
@RenderBody()
</body>

在控制器中,我将动作称为

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

我的 View.cshtml 就像一个 normla html 页面

@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>
4

0 回答 0