Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPDF: Exception thrown when rendering page Options
Simon Scheurer
Posted: Tuesday, June 3, 2014 6:08:13 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
When trying to render a page I get a internal exception from EO.PDF:
Code: C#
size must be between 0 and 129
Parameter name: size
Actual value was 130. Restarting renditioner.
Qumram.Business.Renditions.RenditionerEnvironmentException size must be between 0 and 129
Parameter name: size
Actual value was 130.
Qumram.Business.Renditions.RenditionResultData Run(Qumram.Business.Renditions.RenditionRunData)

The Type it throws in is EO.Pdf.Internal.kz

The actual stack-trace looks like this:
Code: C#
at EO.Pdf.Internal.lm.h.a(g A_0, Byte[] A_1, Int32 A_2)
   at EO.Pdf.Internal.lm.a(a A_0)
   at EO.Pdf.HtmlToPdfSession.a(a A_0)
   at EO.Pdf.HtmlToPdfSession.a(jw A_0, String A_1, String A_2, Int32 A_3, Int32 A_4, Boolean A_5)
   at EO.Pdf.HtmlToPdfSession.a(jw A_0, String A_1, String A_2, Boolean A_3)
   at EO.Pdf.HtmlToPdfSession.LoadHtml(String html)
   at EO.Pdf.HtmlToPdf.ConvertHtml(String html, PdfDocument doc, HtmlToPdfOptions options)
   at Qumram.Business.Renditions.InternalRenditioner.Render(RenditionRunData data, Boolean includeImages, PdfDocument& document) in e:\qumram\Source-Trunk\qumram-business\library\src\Renditions\InternalRenditioner.cs:line 61
   at Qumram.Business.Renditions.InternalRenditioner.Render(RenditionRunData data) in e:\qumram\Source-Trunk\qumram-business\library\src\Renditions\InternalRenditioner.cs:line 42
   at Qumram.Business.Renditions.RenditionerComponent.<>c__DisplayClass4.<Run>b__0() in e:\qumram\Source-Trunk\qumram-business\library\src\Renditions\RenditionerComponent.cs:line 33
   at Qumram.Common.Util.TaskUtil.<>c__DisplayClass1.<TimeoutExecute>b__0() in e:\qumram\Source-Trunk\qumram-common\library\src\Util\TaskUtil.cs:line 67
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)


The page I try to render is the entry page http://www.qumram.ch
The options I use are as follows:
Code: C#
return new HtmlToPdfOptions {
                BaseUrl = baseUrl,
                AutoFitX = HtmlToPdfAutoFitMode.ScaleToFit,
                ProxyInfo = new ProxyInfo(ProxyType.HTTP, host, port),
                AutoBookmark = true,
                SSLVerificationMode = SSLVerificationMode.None,
                PageSize = PdfPageSizes.A4,
                AdditionalHeaders = new[] { string.Format("{0}: {1}", data.HeaderName, data.HeaderValue) },
                Cookies = cookies,
                GeneratePageImages = true,
                HeaderHtmlFormat = string.Format(Defaults.Config.Renditions.HtmlPatternWrapper, data.HeaderHtml),
                HeaderHtmlPosition = 0.4f,
                FooterHtmlFormat = string.Format(Defaults.Config.Renditions.HtmlPatternWrapper, data.FooterHtml),
                MinLoadWaitTime = 0,
                MaxLoadWaitTime = Defaults.Config.Renditions.MaxLoadWaitTimeInMs,
                NoCache = true // May slow down renditions, but otherwise the versions cannot be ensured.
            };

where baseUrl equals "http://www.qumram.com/". The additional header values are just some additional information we process on our side. Footer and Header html are just ordinary html (no links or similar).
eo_support
Posted: Tuesday, June 3, 2014 12:28:01 PM
Rank: Administration
Groups: Administration

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

What version of EO.Pdf do you use? We tested your page with the latest version and it seems to work fine.

Thanks!
Simon Scheurer
Posted: Wednesday, June 4, 2014 10:04:09 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Hi,
we use 5.0.75.2
What version have you been testing with?
Can you give me a hint, what the "between 0 and 129 error" means? Because of the obfuscation it's hard to understand the meaning of that.
This could help us find out whether it is due to some special configuration.
Best regards,
Simon
eo_support
Posted: Wednesday, June 4, 2014 6:52:08 PM
Rank: Administration
Groups: Administration

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

The problem seems to occur when you have a custom font whose font size is set to a number greater than 129. The custom font is a font that import with CSS @font-face. It appears that when we pass the number to Windows API to create a font of that size, the API call fails.

Thanks!
Simon Scheurer
Posted: Thursday, June 5, 2014 12:54:21 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Hi,
thx for the information. That makes sense.
Still we have the issue, that we do not control the sites we are rendering pdf's for (qumram.com we of course control, but this is just a test site). In general I think, it should not throw because of that (or at least throw with a more specific error message).
If the rendering fails for font-sizes bigger than 129 anyway, why not just limit sizes to that? I.e. before calling the Windows API just use the ceiling value (or first hand it in unlimited and if the Windows API throws then truncate it to the max value).
This would at least allow the page to still be rendered albeit not perfect.
We do not know when we will run into this issue in other customer projects and cant enforce all customers to just use smaller fonts.
Best regards,
Simon
eo_support
Posted: Thursday, June 5, 2014 8:43:09 AM
Rank: Administration
Groups: Administration

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

Yes. What you suggested makes sense. We will try to add the code to limit the range. In the mean time, please try to isolate a test case that you can use to verify the problem. That way when we provide you the new build you will be able to verify whether it will indeed work for you.

Thanks!
Simon Scheurer
Posted: Thursday, June 5, 2014 10:14:16 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Hi,
sounds great!
We have a test scenario here that reliably reproduces the issue. So as soon as you have a fix we will be able to react quickly to check whether it solves the issue.
Best regards,
Simon
eo_support
Posted: Tuesday, June 10, 2014 10:58:01 PM
Rank: Administration
Groups: Administration

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

We have posted a new build that automatically limits the font size within valid range. You can download the new build from our download page. Please take a look and let us know if it resolves the problem for you.

If that does not resolve the problem, then we will need you to send us a test project that we can use to reproduce the problem. See here for more details:

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

Thanks!
Simon Scheurer
Posted: Monday, June 16, 2014 4:28:54 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Hi, was busy all the time. Will most probably check tomorrow and inform about the outcomes.
Best regards,
Simon
Simon Scheurer
Posted: Wednesday, June 18, 2014 4:38:01 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Hi, we tried with our test-environment and now the page renders fine. Looks good!
Thanks for the quick solution and best regards,
Simon
eo_support
Posted: Wednesday, June 18, 2014 6:42:55 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Thank you very much for confirming the fix! Please feel free to let us know if there is anything else.
Simon Scheurer
Posted: Friday, July 18, 2014 11:44:22 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Unfortunately I have to re-open that one. While it runs fine now in our development environments (all being Windows 8.1).
We found, that it does not work on the test-server (Windows 2008R2, 64bit). We tested with the latest version (5.0.85.2) where the fix should be in place.

Interestingly the Exception has changed:
"size must be between 0 and 166 Parameter name: size
Actual value was 167."

You may remember that the former message was "0 to 129" and actual value was 130. Maybe just a coincidence but as it is still the same URL (and font size has not changed) I'm wondering whether the value that is acceptable is OS dependent or even something worse (Screen-Driver?)
Anyway as the expected and the actual value can obviously be extracted it should be feasible IMHO to wrap this in a Retry-Block that catches and retries with different values. This may be easier than trying to adjust the value beforehand.

We will test that also on our Windows Server 2012 environment.

Best regards,

Simon
eo_support
Posted: Monday, July 21, 2014 11:08:58 AM
Rank: Administration
Groups: Administration

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

Can you provide the Url/test app that we can use to reproduce this problem? The previous fix limit size to 1 to 128, so this has to be a different place.

Thanks!
Simon Scheurer
Posted: Tuesday, July 22, 2014 6:45:59 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
I'll provide a download-link with a test-tool/url/environment combination for reproduction.
The values are different, but it's still the same page (http://www.qumram.com/) and the same error message.
I'll post the URL here as soon as the test-package is ready.
Best regards,
Simon
eo_support
Posted: Tuesday, July 22, 2014 8:36:22 AM
Rank: Administration
Groups: Administration

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

No problem. You can follow the instructions in the previous link to send the test app to us. We will look into it as soon as we receive that.

Thanks!

Simon Scheurer
Posted: Tuesday, July 22, 2014 9:43:49 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Already got confirmation regarding the environment:
Windows Server 2008 R2 Service Pack 1 64bit
Simon Scheurer
Posted: Tuesday, July 29, 2014 4:55:37 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Hi,

I sent an e-mail with the test-project to support as described above.
The subject of the e-mail contains this forum post subject to easier reference.

E-Mail Content:
"as promised find attached the test-project we use to reproduce the issue:

To reproduce.
1. Make sure that the reference in the project points to a correct EO.pdf location
2. Execute qumram-eo-test-tool /url=http://www.qumram.com/ /output=qumram.pdf /options=src\HtmlToPdfOptions\QumramDefaultOptions.xml

Important:
The error does not reproduce on all environments. We cannot reproduce it for example on Windows 8.1.
The environment where the error occurs is:
Windows Server 2008 R2 Service Pack 1 64bit"

Best regards,

Simon
Simon Scheurer
Posted: Thursday, July 31, 2014 6:51:42 AM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
Just a short ping: Have you received the test-project? Tell me if you need something more.
Best regards,
Simon
eo_support
Posted: Thursday, July 31, 2014 10:08:31 PM
Rank: Administration
Groups: Administration

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

Sorry about the delay. We have been trying to reproduce the problem on different systems but have not been able to reproduce it. Can you download the latest build from our download page, then try to catch the full stack trace when this problem occurs? We might be able to find out something based on that.

Thanks!
Simon Scheurer
Posted: Friday, August 8, 2014 12:09:56 PM
Rank: Advanced Member
Groups: Member

Joined: 5/14/2013
Posts: 45
I'll do so!
Best regards,
Simon


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.