Welcome Guest Search | Active Topics | Sign In | Register

Convertion failed. Parameter is not valid - creating images? Options
Ligia
Posted: Wednesday, February 12, 2014 2:03:32 PM
Rank: Newbie
Groups: Member

Joined: 2/3/2014
Posts: 4
Hi, I have been searching the forums, and I have not really found my answer. Details:
EO.PDF version: 5.0.63.2

Stack Trace:
<p>The server encountered an error processing the request. The exception message is 'Convertion failed. Parameter is not valid.'. See server logs for more details. The exception stack trace is: </p>
<p> at EO.Pdf.HtmlToPdfException.b(Exception A_0)
at EO.Pdf.Internal.l0.d()
at EO.Pdf.HtmlToPdfSession.RenderAsPDF(PdfDocument doc)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, String pdfFileName, HtmlToPdfOptions options)

Code: C#
HtmlToPdf.Options.GeneratePageImages = true;
HtmlToPdf.Options.FooterHtmlFormat =
                "&lt;div style='text-align:center;font-style: italic'&gt;This is the footer tag line and legal&lt;/div&gt;";
HtmlToPdfResult result = HtmlToPdf.ConvertHtml(GetFileHtml, pdfSaveLocation);

foreach (Image image in result.PageImages)
{
	image.Save(imageSaveLocation, ImageFormat.Jpeg);
}


It works fine on my local. The server is RackSpace 2008 Windows Enterprise. Anything I can look to on the server to track this down?

I see in one case the user was instructed to remove the HtmlToPdf.Options.GeneratePageImages = true, but I need to use those images.

Thank you!
Brad
eo_support
Posted: Wednesday, February 12, 2014 4:36:41 PM
Rank: Administration
Groups: Administration

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

Can you post the HtmlToPdfException's InnerException's stack trace?

Thanks!
Ligia
Posted: Wednesday, February 12, 2014 5:18:21 PM
Rank: Newbie
Groups: Member

Joined: 2/3/2014
Posts: 4
Hi eo:

This is the only additional info I have on my YSOD:

[ArgumentException: Parameter is not valid.]
System.Drawing.Image.FromHbitmap(IntPtr hbitmap, IntPtr hpalette) +1157825
System.Drawing.Image.FromHbitmap(IntPtr hbitmap) +76
EO.Pdf.Internal.l0.a(Int32 A_0, HtmlToPdfResult A_1, Int32& A_2) +6005
EO.Pdf.Internal.l0.d() +259

Hopefully that is enough?

Thanks!
eo_support
Posted: Wednesday, February 12, 2014 5:26:42 PM
Rank: Administration
Groups: Administration

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

Yes. This is the same error as the other one and it occurs when the code tries to create a GDI+ plus Image object from a GDI bitmap, which already contains the page image. We have not been able to find out what causes this problem but one thing we could try is add code to save the image as raw bitmap in memory and then construct a GDI+ image from that raw bitmap. We do not know whether this will indeed solve your problem since we can not reproduce the problem in our environment. However if you are willing to try we will be very happy to implement the code and provide a test build for you to verify.

Thanks!
Ligia
Posted: Wednesday, February 12, 2014 6:55:22 PM
Rank: Newbie
Groups: Member

Joined: 2/3/2014
Posts: 4
Hi, that would be wonderful!
Ligia
Posted: Wednesday, February 12, 2014 7:51:47 PM
Rank: Newbie
Groups: Member

Joined: 2/3/2014
Posts: 4
I think it is the server windows version. I moved the site to another location, with a 2008 R2 (SP1), and it works perfectly (original server was 2008 (SP2) - not R2!).

So, no need to do a build for us, but hope this will help someone that goes through this!

Thank you,
Brad
eo_support
Posted: Wednesday, February 12, 2014 7:58:45 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Ah. Thank you very much for the update. I guess Microsoft fixed something on their end. :)


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.