codaxy / wkhtmltopdf

C# wrapper around excellent wkhtmltopdf console utility.
265 stars 92 forks source link

Process timing #36

Open sstelmar opened 1 year ago

sstelmar commented 1 year ago

How do I get this to wait for the HTML internal Java scripts to process before converting to PDF? I am using an external tool to create formal math expressions. See attached examples.

Base HTML document: Calculation (2).zip

As converted by your tools: testcalcs.pdf

As converted by https://html2pdf.com/: Calculation.pdf

My current code: @page "/Calcs"

@code { protected override async Task OnInitializedAsync() { PdfConvert.ConvertHtmlToPdf(new PdfDocument { Url = "https://localhost:44392/Calculation.html", HeaderLeft = "[title]", HeaderRight = "[date] [time]", FooterCenter = "Page [page] of [topage]"

    }, new PdfOutput
    {
        OutputFilePath = "testcalcs.pdf"
    });
}

}

mstijak commented 1 year ago

This is just a simple wrapper around wkhtmltopdf. You should check the options there.

Since this project is no longer maintained, you may also try https://www.puppeteersharp.com/ which offers the same functionality and much more.