Welcome Guest Search | Active Topics | Sign In | Register

EO.Pdf: HtmlToPdfException, Convertion failed. Failed to initialize conversion. Options
anders.ekdahl
Posted: Tuesday, March 20, 2012 3:32:57 AM
Rank: Member
Groups: Member

Joined: 3/16/2012
Posts: 14
Hi,
Some of our customers get an exception when the try to create a PDF from HTML. Here's the stack trace:

EO.Pdf.HtmlToPdfException: Convertion failed. Failed to initialize conversion. ---> System.Exception: Failed to initialize conversion.
at EO.Pdf.Internal.kk.b(Byte[] A_0, Int32 A_1)
at EO.Pdf.Internal.kk.c(Byte[] A_0, Int32 A_1)
at EO.Pdf.Internal.kq.a(String A_0, Boolean A_1, String A_2)
at EO.Pdf.Internal.kq.a()
at EO.Pdf.HtmlToPdfException.b(Exception A_0)
at EO.Pdf.Internal.kq.a()
at EO.Pdf.Internal.kq.b()
at EO.Pdf.HtmlToPdf.a(kq A_0)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, String pdfFileName, HtmlToPdfOptions options)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, String pdfFileName)
---- the rest is our own stack trace ---

Since it doesn't happen to everyone, it might be some permission related issue, but could you help us understand what is causing this exception to be thrown? Is it when EO.Pdf is trying to write to the file given to HtmlToPdf.ConvertHtml()?

We have been able to reproduce it in all versions of EO.Pdf we have used, from 3.0.58.2 to 3.0.121.2.

/Anders
eo_support
Posted: Tuesday, March 20, 2012 7:29:31 AM
Rank: Administration
Groups: Administration

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

Please check your window event log. When you receive this error message, an event log entry will be created. Please let us know the log message.

Thanks!
anders.ekdahl
Posted: Tuesday, March 20, 2012 8:51:12 AM
Rank: Member
Groups: Member

Joined: 3/16/2012
Posts: 14
Hi,
There are three logs in the event log with basically the same information.
Code:

Logname:       Application
Source:        EO Debug Message
Date:          2012-03-20 13:38:31
Event-ID:      0
Category:      None
Level:         Error
Keyword:       Classic
User:          Missing
Computer:      OSTMAN2.erisma.local
Description:
The description for Event ID 0 from source EO Debug Message can not be found. Either the component that created the event is not installed on this computer or the installation is corrupted. Install or Restore component on the computer.

If the event was created from another computer, the display information had to be saved with the event.

The following information was included with the event:

Code = 9. hr = 80131604

Event XML-data:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="EO Debug Message" />
    <EventID Qualifiers="0">0</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2012-03-20T12:38:31.000000000Z" />
    <EventRecordID>66287</EventRecordID>
    <Channel>Application</Channel>
    <Computer>OSTMAN2.erisma.local</Computer>
    <Security />
  </System>
  <EventData>
    <Data>Code = 9. hr = 80131604</Data>
  </EventData>
</Event>


This is from a computer that doesn't have EO.Pdf downloaded installed, it's just running an application that has EO.Pdf.dll bundled that handles the HTML to PDF conversion.

Does this tell you anything, or should we fully install EO.Pdf on that computer?

EDIT:
Tried to install EO.Pdf on that computer, but we still get the "can not be found" part in the event log.

/Anders
eo_support
Posted: Tuesday, March 20, 2012 9:56:10 AM
Rank: Administration
Groups: Administration

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

That occurs when we could not load EO.Pdf.dll. This is almost always a permission issue, but unfortunately there are many difference scenarios that can cause permission deny error and we are no expert on Windows security, so we do not know which permission for sure. A common scenario is when your process runs at a very low privileged account and then uses impersonation to temporarily elevate its permission before calling user code (including us), which is typical in a web server setup. That can cause problem because some part of our code still runs in your process’s security context instead of your calling thread’s security context. So while your calling thread’s security context has higher privileges, your process’ security context does not, which can cause a permission issues in our code.

Install EO.Pdf will not solve the problem. You can try to run your program as administrator and see if it solves the problem. If it does, then it’s a security issue. If your process runs under a different user context, try log in with that user and start the process with that user interactively and see if it works for you. That may help you figure out exactly which part is causing the problem for you.

Thanks!
anders.ekdahl
Posted: Tuesday, March 20, 2012 10:30:16 AM
Rank: Member
Groups: Member

Joined: 3/16/2012
Posts: 14
Hi,
Thanks for the info. The problem goes away if we run our program as administrator, or if we register the application to have FullTrust in Caspol.exe. We were just hoping to avoid forcing our customers to run as administrator/register FullTrust.

/Anders
eo_support
Posted: Tuesday, March 20, 2012 10:36:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
That makes sense. Our code always need full trust because it makes a lot of API calls. That usually is not a problem if your application is a standalone application that runs locally because in that case full trust is automatically granted. However for other setup it is necessary to grant full trust to the DLL.

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.