如何在PDF中添加最后一页?

How to add last page in PDF?

我正在使用 OpenHtmlToPdf。是否可以添加 1 页作为文档的最后一页。我已阅读所有文件,但发现注意到了。

下面是生成pdf文档的相同代码

 string html = Utils.ReadFile(@"C:\inetpub\wwwroot\pdf.html");
        html = html.Replace("###BODY###", "DYNAMIC CONTENT");
        var pdf = Pdf
            .From(html)
            .OfSize(PaperSize.A4)
            .WithTitle("PDF Report With Logo")
            .WithoutOutline()
            .WithObjectSetting("header.htmlUrl", "http://localhost/header.htm")
            .WithObjectSetting("footer.htmlUrl", "http://localhost/footer.htm")
            .WithObjectSetting("web.defaultEncoding", "utf-8")                
            .Landscape()
            .Comressed()
            .Content();

如果您的最后一页也是基于 html,您可以在最终 html 中添加分页器,然后添加页面本身:

html += $"<div style=\"page-break-after: always;\"></div>{your_last_page}";