|
Rank: Member Groups: Member
Joined: 7/17/2016 Posts: 17
|
Hi, We use the EO.Pdf component to generate invoices using the HtmlToPdf.ConvertHtml(string content, Stream stream) method by feeding it a pre-built set of HTML and saving out the output PDF. In the last few days we've had a few random instances of PDF generation failing with the following error: Quote: EO.Pdf.HtmlToPdfException: Conversion failed. Unable to process message. ---> EO.Internal.qd: Unable to process message. at EO.Internal.aiu.a(aiu A_0, alc A_1) at EO.Internal.aiu.a(aa8 A_0, Boolean A_1, a5b A_2) at EO.Internal.aiu.a(aa8 A_0, a5b A_1) --- End of inner exception stack trace --- at EO.Internal.aiu.a(aa8 A_0, a5b A_1) at EO.Pdf.HtmlToPdfSession..ctor(HtmlToPdfOptions A_0) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, Stream stream, HtmlToPdfOptions options) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, Stream stream)
This is using Eo.Base, EO.Pdf, EO.WebBrowser and EO.WebEngine version 16.1.46.0, with the following code called before calling ConvertToHtml(): Quote: HtmlToPdf.Options.PageSize = PdfPageSizes.A4; HtmlToPdf.Options.OutputArea = new RectangleF(0, 0.5f, 8.263889f, 10.6944447f); HtmlToPdf.Options.BaseUrl = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, <a custom storage path of images and css>); HtmlToPdf.UseClassicEngine(); HtmlToPdf.Options.NoCache = true;
Nothing has changed in the version we're using, and nothing has changed in the environment. We've occasionally had this error in the past on the odd occasion, but as our billing service becomes busier, we're seeing increased instances of this occurrances. The error is pretty vague, what could be the cause of this? Regards, Alvaro
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi, Please try two things: 1. Update to the current build. Make sure you download a new key for the current version from your account. The new key should be free for you. 2. Set this property to true: https://www.essentialobjects.com/doc/eo.base.runtime.enableeowp.aspxThe error message you received usually occurs when a child process used by the converter has crashed. This can occurs for many reasons, but one of the most common one is an out of memory error when converting big files. Setting EnableEOWP to true will allocate more memory to the child process thus may reduce the frequency of this error for you. Please let us know how it goes. Thanks!
|
|
Rank: Member Groups: Member
Joined: 7/17/2016 Posts: 17
|
Many thanks for the speedy reply, we'll try getting the latest build and do some testing.
The way we use EO.Pdf is within a Windows service that is continually running, and has a dispatcher pattern that means that up to 8 threads may be running ConvertHtml() at once, are we assuming correct that the ConvertHtml() method is thread safe?
Presumably setting the HtmlToPdf.Options once upon service start up is enough for any subsequent ConvertHtml() method call to pick these up, on all threads?
Regards, Alvaro
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hi,
Yes, ConvertHtml is thread safe. However, each thread has its own copy of HtmlToPdf.Options, so you must set them in each thread.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 7/17/2016 Posts: 17
|
We've been doing some experimentation with the EO.Base.Runtime.EnableOWP by setting it to true, and we've tried both copying eowp.exe to the same folder as EO.Base.dll and not copying it, and our code generates a PDF either way, which is making us suspicious that it's not using eowp.exe - is this expected behaviour? Is there a way to trace whether eowp.exe is being used or not?
We can't see eowp.exe listed in the processes list using something like Process Explorer.
Regards, Alvaro
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hello,
When you have EnableEOWP set to true, you should see process name as eowp.xxxxx.exe or just eowp.exe in your process list. Here "xxxx" is the version number. If it never appears, check if you are viewing all processes in the system or just viewing the processes for the current login session. If you are viewing all processes in the system and still do not see them, then we will need to take a look of the system in order to investigate further. We can do this through TeamViewer. Please let us know.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 7/17/2016 Posts: 17
|
After a bit of testing, having EO.Base.Runtime.EnableEOWP = true, if we include eowp.exe to the same folder as EO.Base.dll we see this: If we don't include the eowp.exe, we see this: Is there an advantage in including the exe? It seems like the dll can spawn child processes without the exe? Regards, Alvaro
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
Hello,
The main advantage is eowp.exe can use up to 4GB memory space per process, where as rundll32.exe can only use up to 2GB memory. So for example, if you have a very large page, then it can run fine with eowp.exe but not with rundll32.exe.
Another advantage is because rundll32.exe is a system file, many AntiVirus is very sensitive about it. So you can have cases where an AntiVirus can raise false alarm when rundll32.exe is used but not when eowp.exe is used, even though most modern AntiVirus program is smart enough not to solely based on exe name, for those program it will work either way.
Thanks!
|
|