Recipe.Wkhtmltopdf with JsReport.Local and AspNetCore not working



  • When i use
    HttpContext.JsReportFeature().Recipe(Recipe.Wkhtmltopdf)
    I get the following error
    Error during rendering report: Recipe 'wkhtmltopdf' not found

    Is there a way to make this recipe available to the jsreport.aspnetcore local server?



  • Only the default recipes are present in the jsreport.Local. To install the additional recipes, please follow these steps:

    1. Create folder jsreport in your project

    2. Make sure the whole folder is being copied to the output directory. This can be done using wildcard in the csproj file.

    <ItemGroup>
        <None Include="jsreport\**\*.*">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>
    
    1. Run npm install jsreport-wkhtmltopdf in the jsreport folder

    2. Create dev.config.json there

    {
        "discover":  true
    }
    

    There additional wkhtmltopdf recipe should now work.



  • Thank you, little confused though, jsreport-mssql-store will contain the wkhtmltopdf recipe?



  • Ah, I did copy paste it from another answer on SO and forgot to change it. The answer is updated now.



  • For those who come after, this answer is in another forum post, but it took me a while to find it. If you run npm install jsreport-wkhtmltopdf in your jsreport folder and get no node_modules directory and a short error that looks similar to this:

    jsreport-server@ C:\Users\my-too-long\path-to-visual-studio-project
    `-- jsreport-wkhtmltopdf@1.4.0
    
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    npm WARN react-copy-to-clipboard@4.3.0 requires a peer of react@^0.14 || ^15 but none was installed.
    npm WARN jsreport-server@ No description
    npm WARN jsreport-server@ No repository field.
    npm WARN jsreport-server@ No license field.
    

    then my problem was that the path to the VS project was too long. Moving it up to something short like d:\my-vs-projects\ and running it gave the Done! wkhtmltopddf binary available at vendor\whktmltopdf.exe and a big long tree display of installed packages, and the node_modules directory with stuff in it.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.