Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf.ConvertHtml causes OutOfMemoryException after upgrading version Options
Charlie McWilliams
Posted: Friday, May 24, 2019 9:01:18 AM
Rank: Newbie
Groups: Member

Joined: 5/24/2019
Posts: 3
We primarily use EO.pdf for converting HTML to PDF reports. The content is user-driven, so the resulting PDF files range anywhere from a single page to 15+ pages. As part of our last software release, we upgraded our EO.pdf nuget package from 19.0.56 to 19.0.97. A few days after our release to production, we received some complaints from customers that certain reports weren't rendering. I was able to reproduce this in our dev environment. I confirmed that downgrading to 19.0.56 fixed the issue. I also tried upgrading to the latest version (19.1.40) to see if the issue had been fixed in a subsequent version, and it had not. Here is the exception and stack trace:

Exception: EO.Pdf.HtmlToPdfException: Conversion failed. Array dimensions exceeded supported range. ---> System.OutOfMemoryException: Array dimensions exceeded supported range.
at EO.Internal.pb.b.b()
at EO.Internal.pb.a(b A_0, a8d A_1, WriteArgDelegate A_2)
at EO.Internal.pb.a(HtmlToPdfOptions A_0, Single A_1, Single A_2, amc A_3, List`1 A_4, af8 A_5)
at EO.Internal.a3k.a(af8 A_0, Single& A_1)
at EO.Internal.a3k.a(af8 A_0)
--- End of inner exception stack trace ---
at EO.Pdf.HtmlToPdfException.b(Exception A_0)
at EO.Internal.a3k.a(af8 A_0)
at EO.Pdf.HtmlToPdfSession.RenderAsPDF(PdfPage page)
at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfPage page, HtmlToPdfOptions options)

Is this a defect that has already been identified and will be fixed in a future release?
eo_support
Posted: Sunday, May 26, 2019 9:47:13 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,360
Hi,

We have changed paging mechanism in 19.0.97 and that might be what caused the problem. Can you try to isolate the problem to a test project and send the test project to us? Please see here for more details:

https://www.essentialobjects.com/forum/test_project.aspx

Once we receive the test project we will look into it as soon as possible.

Thanks!
Charlie McWilliams
Posted: Wednesday, June 12, 2019 11:00:53 AM
Rank: Newbie
Groups: Member

Joined: 5/24/2019
Posts: 3
I have submitted a test project per the instructions in the provided link. Thanks for your help.
eo_support
Posted: Thursday, June 13, 2019 1:45:57 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,360
Hi,

We have looked into the sample project. The root cause is the page height setting when you call ConvertHtml. The height is set to 0.01 inch which is less than 1 pixel. This causes one of our internal function to treat the page height as 0 pixel thus keep paging without advancing a single pixel forward. We have changed our code to enforce a minimum 5 pixel per page. The fix will be in our next build and we will reply here again when the new build is available.

Thanks!
Charlie McWilliams
Posted: Thursday, June 13, 2019 2:09:52 PM
Rank: Newbie
Groups: Member

Joined: 5/24/2019
Posts: 3
Just curious, but how are you going to enforce the minimum? If the value is less than 5, are you going to just use 5 instead or are you going to throw an exception? We expose that setting to our end users, so if you are going to throw an exception we'll likely want to change the validation in our application to avoid unexpected exceptions.

Thanks!
eo_support
Posted: Thursday, June 13, 2019 2:32:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,360
We are just going to use 5 instead. We are also adding logic where as if you call ConvertHtml(html, page) then it will not try to page at all. The paging logic should only be called when you call ConvertHtml(html, doc).
eo_support
Posted: Wednesday, June 19, 2019 12:35:37 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,360
Hi,

We have posted a new build that should resolve this issue. You can download the new build from our download page. Please take a look and let us know how it goes.

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.