Search code examples
wkhtmltopdfnreco

NReco pdf generator issue


I am getting the exact same error code as this question. I also read the answer to that post but not sure how it'll help in the context of this specific error.

NReco PDF generator works when I omit this line in this html file:

                <tr>
                    <td valign="bottom"><div align="left" class="P ">- Other Receipts</div></td>
                    <td valign="bottom"><div align="center" class="P ">(36)</div></td>
                    <td valign="bottom"><div align="right" class="P ">83,00</div></td>
                </tr>

If I do include that line I get the (exit code: -1073741819) exception. If I really want to include that line, then I must omit this line of code at the header of the same html file:

        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />

For me this is beyond irrational behavior. I dont see how styling or the content that I add in the html file will cause it to crash.

Can anyone assist me with this?


Solution

  • NReco.PdfGenerator is a .NET wrapper for wkhtmltopdf, and this kind of exception indicates that 'wkhtmltopdf.exe' process is crushed for unknown reason.

    This means that you need to check what in wkhtmltopdf causes a crush -- you may do that in the command line, actually. Typical reasons:

    • CSS border-radius rules in some specific cases may cause a crush
    • if page margins are defined explicitly and it is not enough space for header or footer content this also may cause wkhtmltopdf crush

    Unfortunately only way to find a workaround are experiments, however in most cases workaround is possible.