Welcome Guest Search | Active Topics | Sign In | Register

HtmlToPdf ConvertHtml not resizing amCharts correctly Options
Jamie
Posted: Friday, October 31, 2014 4:28:02 PM
Rank: Newbie
Groups: Member

Joined: 10/31/2014
Posts: 2
I've just started using HtmlToPdf convertHtml with amCharts and one issue that I'm battling with is it seems that html to pdf is having a problem with resizing amCharts correctly and the resulting pdf doesn't look correct. It could be an issue with amCharts though, I'm not sure what event it's listening for to trigger its resize...

My amChart is set to 100% width and resizes with the browser and basically remains in the middle of it's parent. The chart sits above my report table and is always centred over my table. In the generated pdf the space that is to the left of the chart doesn't change although the ScaleToFit is scaling down the table and as a result the chart can appear to the right and out of view or just clipped.

Has anyone else run into this with amCharts or another element than can help out.
eo_support
Posted: Sunday, November 2, 2014 3:36:13 PM
Rank: Administration
Groups: Administration

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

Please try two things:

1. Try to force your page to be wider. For example, you can do this by adding something like this in your HTML:

Code: HTML/ASPX
<div style="width:1000px;height:1px;"></div>


The reason is by default the HTML to PDF converter's "window width" is much smaller than a typical web page's width (because the paper width is smaller than the screen width). Our HTML to PDF converter will try to automatically detect the minimum width of your page contents and then apply zoom factor based on that. Certain page can not handle layout correctly when the window width is too small. Forcing the page to be wider will help you avoid such issues;

2. Increase HtmlToPdf.Options.MinLoadWaitTime. Some page uses JavaScript to dynamically create page contents. However the HTML to PDF converter does not know when your JavaScript has finished running. It is possible that the converter started before your JavaScript code has finished running ---- for example, the converter might have kicked in before amChart detected window resize but actually finishes resizing itself. In that case you can try to increase MinLoadWaitTime to give your JavaScript more time to run;

If neither of the above resolves the issue for you, please try to isolate the issue into a test page and post the test page. Once we have that we will try to run it here and see if we can reproduce the problem here.

Thanks!
Jamie
Posted: Monday, November 3, 2014 2:59:20 PM
Rank: Newbie
Groups: Member

Joined: 10/31/2014
Posts: 2
My issue turned out to be a missing script from the html that I was passing to the converter. The missing script was causing the chart rendering to fail, so it wasn't being resized.
eo_support
Posted: Monday, November 3, 2014 3:04:24 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Ah. That makes perfect sense. Thank you very much for letting us know!


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.