Search code examples
c#.netpdfrotativa

Rotativa breaks the HTML when there is more than one page


I am creating a pdf from HTML using Rotativa, and my code looks like this

     var CustomSwitches = "--footer-right \"Date: [date] [time]\" " + "--footer-center \"Page: [page] of [toPage]\" --footer-line --footer-font-size \"9\" --footer-spacing 5 --footer-font-name \"calibri light\"";

    var rotativaOptions = new DriverOptions { CustomSwitches = CustomSwitches,PageSize = Size.A4};

    return new ViewAsPdf("~/Views/Partials/Report/SummaryReportspdf.cshtml")
    {
        RotativaOptions = rotativaOptions
    };

All looks good to me, but when there is more than one page, page breaks even. And it looks like below image enter image description here

How can I solve this issue?


Solution

  • I solved this problem using the latest version of wkhtmltopdf (currently version 0.12.5)

    You can download it from here: https://wkhtmltopdf.org/downloads.html

    Hope it helps!