Welcome Guest Search | Active Topics | Sign In | Register

Unable to cast object of type 'EO.Pdf.HtmlToPdfOptions' to type 'System.IServiceProvider'. Options
BrianS
Posted: Tuesday, September 6, 2011 2:32:08 PM
Rank: Newbie
Groups: Member

Joined: 9/6/2011
Posts: 5
Hey all, i'm using the AspxtoPdf control on my page, and when i click a button i run the following event handler in the vb backend
Quote:

Protected Sub lnkSaveAsPDF_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkSaveAsPDF.Click
EO.Pdf.Runtime.AddLicense( _ <long license key>)

ASPXToPDF1.RenderAsPDF()
End Sub


then i get the following error page:

Quote:
Unable to cast object of type 'EO.Pdf.HtmlToPdfOptions' to type 'System.IServiceProvider'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Unable to cast object of type 'EO.Pdf.HtmlToPdfOptions' to type 'System.IServiceProvider'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

Quote:
[InvalidCastException: Unable to cast object of type 'EO.Pdf.HtmlToPdfOptions' to type 'System.IServiceProvider'.]
EO.Web.ASPXToPDF.a(String A_0, String A_1) +1112
EO.Web.Internal.ma.a(HttpResponse A_0, String A_1) +139
EO.Web.Internal.iq.a(HtmlTextWriter A_0, Control A_1) +221
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +100
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060

eo_support
Posted: Tuesday, September 6, 2011 2:34:52 PM
Rank: Administration
Groups: Administration

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

That's because your EO.Pdf.dll is too old. Please try to download the latest EO.Pdf from our download page, then copy the new DLL over to your website's bin directory. That should resolve the issue for you.

Thanks!
BrianS
Posted: Tuesday, September 6, 2011 2:49:07 PM
Rank: Newbie
Groups: Member

Joined: 9/6/2011
Posts: 5
thanks much that got it to render, btw, is it supposed to render images and spacing of the page the same as if it was displayed in browser, i'm getting image placeholders, and large spaces from images in my masterpage
eo_support
Posted: Tuesday, September 6, 2011 3:18:07 PM
Rank: Administration
Groups: Administration

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

It supposes to render everything exactly the same as your browser. However there are several major browsers and they may render things differently. Our rendering should be most close to Google Chrome and Apple Safari. If you see significant difference between our result and Chrome/Safari, please post a test page and we will be happy to take a look.

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.