DinkToPdf / wkhtmltopdf prints only 19 pages even with 64-bit DLL
08:06 15 Nov 2025

I am generating a PDF in ASP.NET Core using DinkToPdf (wkhtmltopdf wrapper).
My HTML report is around 20+ pages, but the generated PDF always stops at 19 pages. It never prints the full content.

PDF Is downloaded successfully don't gave any blockage but only print 19 pages.

Here is my full conversion code:

var doc = new HtmlToPdfDocument()
{
    GlobalSettings = {
        PaperSize = PaperKind.A4,
        Orientation = Orientation.Portrait,
        Margins = new MarginSettings { Top = 40, Bottom = 20, Left = 0, Right = 0 },
        DocumentTitle = "Survey Report"
    },
    Objects = {
        new ObjectSettings
        {
            HtmlContent = htmlData.body,
            WebSettings = { 
                DefaultEncoding = "utf-8",
                EnableJavascript = false 
            },
            PagesCount = true,
            HeaderSettings = new HeaderSettings
            {
                HtmUrl = headerPath,
                Line = true,
                Spacing = 20
            },
            FooterSettings = new FooterSettings
            {
                HtmUrl = footerPath,
                Line = true,
                Spacing = 5
            }
        }
    }
};
I also tried with :- 

EnableIntelligentShrinking = false

Adding flags:--disable-smart-shrinking --enable-local-file-access --keep-relative-links

Reducing margins

Loading header/footer with HtmlContent instead of HtmUrl

Removing images

Using the latest wkhtmltopdf 0.12.6

Still the PDF stops at exactly 19 pages, even though the HTML has more content.

c# asp.net-core pdf wkhtmltopdf dinktopdf