Search code examples
asp.netwkhtmltopdfhtml-to-pdfnreco

Why wkhtmtopdf.exe is generated in root directory in Nrco Html to pdf library?


I am using Nreco Html to Pdf library in asp.net. It has used wkhtmltopdf.exe internally and it generates in bin folder. I have also notice that it creates wkhtmltopdf.exe outside bin folder in root directory.

Does anyone faces this issue?


Solution

  • PdfGenerator extracts wkhtmltopdf binaries on first use to the same folder where NReco.PdfGenerator.dll is located. You can specify the location for these files explicitly by setting "PdfToolPath" property, for example:

    var htmlToPdf = new HtmlToPdfConverter();
    htmlToPdf.PdfToolPath = Server.MapPath("~/App_Data/PdfGenerator");