Search code examples
c#asp.net-mvcrotativa

Add footer spacing in rotativa


I have an html for footer page which contains more than 3 lines of texts, I have applied the below code to show footer in my pdf , but it shows only 2 lines, how do I set height for footer text section?

string header = Server.MapPath("~/Views/Home/PrintHeader.html");
        string footer = Server.MapPath("~/Views/Home/PrintFooter.html");

        string customSwitches = //string.Format("" +
                                string.Format("" +
                                "--footer-html \"{1}\" " +
                               "--footer-spacing \"0\" " +
                               "--footer-font-size \"10\" ", header, footer);

Solution

  • The height for the footer can change by setting margins to the page.

    return new ViewAsPdf("Report", model)
            {
                FileName = fileName + ".pdf",
                CustomSwitches = customSwitches,
                PageOrientation = Rotativa.Options.Orientation.Portrait,
                PageSize = Rotativa.Options.Size.A4,
                PageMargins = new Margins(10, 3, 20, 3)
            };