Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SelectPdf HtmlToImage throwing "Conversion error: Unknown error"

Tags:

c#

pdf

selectpdf

I am using SelectPDF to generate pdfs from a cshtml template. My PDF generates locally, but when on production I get an error.

Stack trace: at SelectPdf.HtmlToImage.?(String A_0, String A_1, String A_2, ?[]& A_3, ?& A_4)\r\n at SelectPdf.HtmlToPdf.?(String A_0, String A_1, String A_2, String A_3, Boolean A_4)\r\n at SelectPdf.HtmlToPdf.ConvertHtmlString(String htmlString)\r\n at Test.GenerateSelectPDF(ReportObj report)\r\n at Test.ReportsController.d__6.MoveNext()

I've ensured that the dll, Select.Pdf.dll and Select.Html.dep are in my bin folder along with Select.Pdf.xml and Select.Tools.dep.

Since I can generate the same report locally I think this is a configuration issue.

like image 208
NetHawk Avatar asked May 16 '26 19:05

NetHawk


1 Answers

Check the execution by increasing the MaxPageLoadTime property of the converter (HTMLToPDF object)

By default, the value is 60 seconds

Example:

converter.Options.MaxPageLoadTime = 240;

Reference: Link

like image 187
Aravindakumar S Avatar answered May 19 '26 10:05

Aravindakumar S



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!