|
Rank: Newbie Groups: Member
Joined: 10/5/2011 Posts: 5
|
I am using the ASPXToPDF and it works on my development pc, but I can't get the pdf to load on the web server. The web server has Windows Server 2008 R2 with IIS 7.
The code I have is: Dim fileName As String = "123456" & String.Format("-{0:yyyy-MM-dd}.pdf", Now) EO.Pdf.Runtime.AddLicense(######) EO.Pdf.HtmlToPdf.Options.OutputArea = New RectangleF(0.25F, 0.5F, 8.0F, 10.0F) EO.Pdf.HtmlToPdf.Options.VisibleElementIds = "TableForPDF" ASPXToPDF1.RenderAsPDF(fileName)
Here is the error message and stack trace.
Error Message: Exception has been thrown by the target of an invocation.
Page Error Occurred: /FFS/Report_FFS_Site.aspx
ExceptionType: System.Reflection.TargetInvocationException
Stack Trace: at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at EO.Web.Internal.db.a(String A_0, Object A_1) at EO.Web.ASPXToPDF.a(Object A_0, String A_1, String A_2) at EO.Web.Internal.mb.a(HttpResponse A_0, String A_1) at EO.Web.Internal.is.a(HtmlTextWriter A_0, Control A_1) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Page.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, There are several possibilities, one is you have a very recent version of EO.Web.dll but an older version of EO.Pdf.dll. So please try to update both from our download page and try again. If the problem still occurs with the latest build, then you can try to call the following code in your event handler directly:
Code: C#
//Call ConvertHtml directly. ASPXToPDF internally
//calls this function
EO.Pdf.PdfDocument doc = new EO.Pdf.PdfDocument();
EO.Pdf.HtmlToPdf.ConvertHtml("test", doc);
This code will not fix the problem, however it will give you the "real" error message rather than a TargetInvocationException. That message should help us to identify what the real problem is. Note that you will need to reference EO.Pdf in order to compile the above code. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/5/2011 Posts: 5
|
I do have the latest version of the EO.Web and EO.pdf.
I replaced my code with this code and when I ran it nothing happened. No errors. No pdf document appeared.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
The above code will not produce any pdf document. It created a PdfDocument object in memory and then discarded it.
Please check two things:
1. The exact version number of your EO.Web.dll and EO.Pdf.dll in your application's bin folder (check the files on your server, not on your local machine); 2. Full stack trace for the InnerException of the TargetInvocationException exception. You may need to check your event viewer for this information, or to handle your global application's class Application_Error event to obtain this information;
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 10/5/2011 Posts: 5
|
1. EO.pdf version is 3.0.75.2. The EO.Web is version 9.0.27.2 2. Here is the innerException for the TargetInovactionException. Inner Stack Trace: at EO.Pdf.HtmlToPdfException.b(Exception A_0) at EO.Pdf.Internal.kc.h() at EO.Pdf.HtmlToPdf.a(kc A_0) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc)
Thanks for your help.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
What is the error message for your InnerException? Also what is the message and stack trace for the InnerException's InnerException (there should be one more)? Please try to collect them all until InnerException is null.
Thanks
|
|
Rank: Newbie Groups: Member
Joined: 10/5/2011 Posts: 5
|
Here you go.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> EO.Pdf.HtmlToPdfException: Convertion failed. Operation times out. ---> System.Exception: Operation times out. at EO.Pdf.Internal.j7.c(Byte[] A_0, Int32 A_1) at EO.Pdf.Internal.kc.a(String A_0, Boolean A_1, String A_2) at EO.Pdf.Internal.kc.h() --- End of inner exception stack trace --- at EO.Pdf.HtmlToPdfException.b(Exception A_0) at EO.Pdf.Internal.kc.h() at EO.Pdf.HtmlToPdf.a(kc A_0) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc) --- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at EO.Web.Internal.db.a(String A_0, Object A_1) at EO.Web.ASPXToPDF.a(Object A_0, String A_1, String A_2) at EO.Web.Internal.mb.a(HttpResponse A_0, String A_1) at EO.Web.Internal.is.a(HtmlTextWriter A_0, Control A_1) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Page.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)EO.Pdf.HtmlToPdfException: Convertion failed. Operation times out. ---> System.Exception: Operation times out. at EO.Pdf.Internal.j7.c(Byte[] A_0, Int32 A_1) at EO.Pdf.Internal.kc.a(String A_0, Boolean A_1, String A_2) at EO.Pdf.Internal.kc.h() --- End of inner exception stack trace --- at EO.Pdf.HtmlToPdfException.b(Exception A_0) at EO.Pdf.Internal.kc.h() at EO.Pdf.HtmlToPdf.a(kc A_0) at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc)System.Exception: Operation times out. at EO.Pdf.Internal.j7.c(Byte[] A_0, Int32 A_1) at EO.Pdf.Internal.kc.a(String A_0, Boolean A_1, String A_2) at EO.Pdf.Internal.kc.h()
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Thanks for the additional information. Timeout error can be a normal error. It can occur if there are resources referenced by your page can not be loaded in time; or simply because your page is too large thus it takes longer than expected to convert. It can also be a bug in our code. For example, we may fall into an infinite loop and can not come out.
Please try the following:
1. Try to run ASPXToPDF inside a blank page (no master page) and see if that works. If that works, then it indicates the problem is not related to your server environment, but related to your page;
2. If step one indicates the problem is related to your page, try to remove contents block by block from your page to see if you can figure out what triggered the problem;
3. If you can figure out what triggered the problem, then see if you can create a test project to duplicate the problem. If you can duplicate the problem, you can send the test project to us. We will be very happy to look into it and see if we can see the same problem here;
As soon as we can duplicate the problem in our environment, we should be able to find out the root cause for it.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 10/5/2011 Posts: 5
|
I've found that if I remove the master page and replace it with a blank master it opens the pdf. It does take about 30 seconds to open.
If I try to open a pdf with just the original master it will open, but the images are missing.
Could it be an issue on the server? As I mentioned it is a Windows Server 2008 R2 64 bit with IIS 7.5.
This works on my development pc (Windows 7 - 64) and on another test server that is running Windows Server 2003 SP2 with IIS 6.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That makes sense. Basically something in your master page (for example, an image) is taking a long time to load and causing time out for the HTML to PDF converter. You can try to raise HtmlToPdf.Options.MaxLoadWaitTime to increase the time out value. However the fact that the page takes 30 seconds to convert does indicate a problem somewhere else. You may want to check your IIS logs to find out which request is taking the time. The conversion should be very quick. What takes time is for the converter to load all the resources used by your page (images, javascript, etc). You may also want to comment contents out of your master page piece by piece to see what triggered the delay.
Thanks
|
|