Hello,
hope you are doing well. We have been facing intermediate issues where conversion from html (url) to pdf is throwing a timeout. We don't see this every day but some times timed out error is happening. Retrying the same conversion always works so it's not an issue with data no being available or the size of the data.
Do you know what can cause this error? So we can take preventive measurements.
Error:
Conversion failed. Operation timed out.Type: EO.Pdf.HtmlToPdfExceptionsource: EO.PdfStackTrace: at EO.Pdf.HtmlToPdfException.b(Exception A_0)
at EO.Internal.a3g.a(agd A_0)
at EO.Pdf.HtmlToPdfSession.RenderAsPDF(PdfDocument doc)
at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc, HtmlToPdfOptions options)
at EO.Pdf.HtmlToPdf.ConvertUrl(String url, Stream stream, HtmlToPdfOptions options)
at Canvas.Service.Utilities.DailyUtil.GetDailyCheckPreviewPdf(Int64 dailyId, String userId)
20190307-08.40.42.7753 ::svcCanvasPubRW :: ERROR :: Operation timed out.Type: System.Exceptionsource: EO.PdfStackTrace: at EO.Internal.pe.b()
at EO.Internal.pe.a(HtmlToPdfOptions A_0, Single A_1, Single A_2, amh A_3, List`1 A_4, agd A_5)
at EO.Internal.a3g.a(agd A_0, Single& A_1)
at EO.Internal.a3g.a(agd A_0)
Our code:
Code: C#
EO.WebBrowser.ThreadRunner threadRunner = new EO.WebBrowser.ThreadRunner(Guid.NewGuid().ToString());
EO.WebBrowser.WebView webView = threadRunner.CreateWebView();
HtmlToPdfOptions op = new HtmlToPdfOptions();
op.PageSize = new SizeF(8.5f, 11.69f);
op.OutputArea = new RectangleF(0, 0, 8.5f, 11.69f);
op.TriggerMode = HtmlToPdfTriggerMode.Dual;
op.BeforeRenderPage = new PdfPageEventHandler(On_BeforeRenderPage);
op.AfterRenderPage = new PdfPageEventHandler(On_AfterRenderPage);
HtmlToPdf.Options.NoCache = true;
//Lowering quality of images so that conversion will be faster
HtmlToPdf.Options.JpegQualityLevel = 100;
HtmlToPdf.Options.MaxLoadWaitTime = 60000;
HtmlToPdf.Options.RetrieveNodeText = false;
op.UserName ="user"
op.Password = "pass"
MemoryStream ms = new MemoryStream();
HtmlToPdf.ConvertUrl(string.Format(dailyPreviewUrl, dailyId, ""), ms, op);
HtmlToPdf.ClearResult();
//Save to memory stream and return back
return ms.ToArray();
Thanks!