Welcome Guest Search | Active Topics | Sign In | Register

"The type initializer for 'EO.Internal.ob' threw an exception." Options
Kunal Choudhary
Posted: Monday, December 23, 2019 4:19:34 PM
Rank: Member
Groups: Member

Joined: 6/14/2013
Posts: 11
Hi,

We upgraded to latest version of EO PDF 2019 for usage in azure web app.

Most of the times the component works but it fails sometimes with following exception when there are multiple requests concurrently.

Here is the code in question that fails.

Code: C#
EO.Pdf.Runtime.AddLicense(pdfParams.Key);
//HtmlToPdf.CacheFolder = pdfParams.CacheFolderPath;
PdfDocument doc = new PdfDocument();                 

var htmltopdfOptions = new HtmlToPdfOptions();
htmltopdfOptions.MinLoadWaitTime = pdfParams.MinLoadWaitTime;
htmltopdfOptions.AdditionalHeaders = pdfParams.CustomHeader;
htmltopdfOptions.HeaderHtmlFormat = pdfParams.Header ?? "PDF converted from {url}<hr />";
htmltopdfOptions.FooterHtmlFormat = pdfParams.Footer ?? @"<div style=""text-align:right;margin-right:5px;""><span style=""font-family:Arial,Verdana;font-size:9px;"">" + DateTime.Now.ToShortDateString() + @" | Page {page_number} of {total_pages}</span></div>";
htmltopdfOptions.FooterHtmlPosition = pdfParams.FooterHtmlPostion;
htmltopdfOptions.OutputArea = pdfParams.OutputArea.IsEmpty ? new RectangleF(0.075f, 0.25f, 8.35f, 10f) : pdfParams.OutputArea;

htmltopdfOptions.NoCache = true;
htmltopdfOptions.AutoAdjustForDPI = true;
htmltopdfOptions.PageSize = new System.Drawing.SizeF(8.5f, 11f);
htmltopdfOptions.ZoomLevel = 1f;
htmltopdfOptions.InvisibleElementIds = pdfParams.HideItemIds ?? string.Empty;
htmltopdfOptions.AutoFitX = HtmlToPdfAutoFitMode.ScaleToFit;                  
htmltopdfOptions.MaxLoadWaitTime = 60000;//1 min = 60000 ms
htmltopdfOptions.NoLink = false;                  
if (pdfParams.IsRta)
   htmltopdfOptions.TriggerMode = HtmlToPdfTriggerMode.Manual;
htmltopdfOptions.GeneratePageImages = true;
htmltopdfOptions.Cookies.Add(pdfParams.Cookies);                
HtmlToPdf.ConvertUrl(pdfParams.Url, doc, htmltopdfOptions);


Exception>>>
System.Exception: HtmlToPdf.ConvertUrl failed
initializer for 'EO.Internal.ob' threw an exception. ---> System.ComponentModel.Win32Exception: Insufficient system resources exist to complete the requested service

"The type initializer for 'EO.Internal.ob' threw an exception." at EO.Internal.ob..ctor(at A_0, HtmlToPdfOptions A_1)\r\n at EO.Pdf.HtmlToPdfSession.a(HtmlToPdfOptions A_0)\r\n at EO.Pdf.HtmlToPdfSession..ctor(HtmlToPdfOptions A_0, HtmlToPdfSession A_1)\r\n at EO.Pdf.HtmlToPdf.b.a()\r\n at EO.Internal.aj9.a[a](aox A_0)\r\n at EO.Pdf.HtmlToPdf.ConvertUrl(String url, PdfDocument doc, HtmlToPdfOptions options)\r\n

Please let us know what should be changed so that we can get rid of the error.

Regards,
M
eo_support
Posted: Monday, December 23, 2019 4:26:14 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

This most likely is just due to temporarily system overload. However if you can post the full InnerException we might be able to find out some more information for you.

Thanks!
Kunal Choudhary
Posted: Monday, December 30, 2019 12:40:26 PM
Rank: Member
Groups: Member

Joined: 6/14/2013
Posts: 11
Hi,

The innerexception details is only this much.

{System.TypeInitializationException: The type initializer for 'EO.Internal.ob' threw an exception. ---> System.ComponentModel.Win32Exception: Insufficient system resources exist to complete the requested service --- End of inner exception stack trace ---}

Regards,
M
eo_support
Posted: Monday, December 30, 2019 4:38:03 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,218
Hi,

There is a stack trace associated to each of these exceptions. What's the stack trace for the Win32Exception?

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.