Welcome Guest Search | Active Topics | Sign In | Register

Highcharts are redrawing AFTER PDF is generated Options
Droddy
Posted: Thursday, April 10, 2014 2:04:18 PM
Rank: Member
Groups: Member

Joined: 1/22/2014
Posts: 20
The Highcharts in my pages are not filling the full available width of the page when converting the page using the latest HtmlToPdf converter.
When I Debug the manual conversion and log info to the console about window.resize, and the chart.resize events that follow, I can see that the window and charts are resizing after the call to eopdf.convert().

Notice below that we see one window resize logged first, followed by several Highchart redraws before eopdf.convert() is called. After eopdf.convert() is called the window is resized a few more times followed by the redraw of all the charts.

When I write the resize/redraw logging info to the page rather than the console, that last batch of chart redraws doesn't make it into the PDF--indicating that the PDF is generated before the charts have a chance to redraw after the window is resized after the convert() call.

Is eopdf setup to wait until all charts are done redrawing before generating the PDF?

JS LOG:
resizeIndex: 1
JS LOG:
redraw: chartWidth: 200, docWidth: 616
JS LOG:
redraw: chartWidth: 380, docWidth: 616
JS LOG:
redraw: chartWidth: 740, docWidth: 616
JS LOG:
redraw: chartWidth: 592, docWidth: 616
JS LOG:
redraw: chartWidth: 240, docWidth: 616
JS LOG:
redraw: chartWidth: 240, docWidth: 616
JS LOG:
redraw: chartWidth: 592, docWidth: 616
JS LOG:
redraw: chartWidth: 592, docWidth: 616
JS LOG:
redraw: chartWidth: 592, docWidth: 616
JS LOG:
redraw: chartWidth: 592, docWidth: 616
JS LOG:
redraw: chartWidth: 380, docWidth: 616
JS LOG:
redraw: chartWidth: 380, docWidth: 616
JS LOG:
redraw: chartWidth: 592, docWidth: 616
JS LOG:
redraw: chartWidth: 200, docWidth: 616
JS LOG:
redraw: chartWidth: 90, docWidth: 616
JS LOG:
before eopdf.convert
JS LOG:
after eopdf.convert
JS LOG:
resizeIndex: 2
JS LOG:
resizeIndex: 3
JS LOG:
resizeIndex: 4
JS LOG:
redraw: chartWidth: 200, docWidth: 768
JS LOG:
redraw: chartWidth: 740, docWidth: 768
JS LOG:
redraw: chartWidth: 200, docWidth: 768
JS LOG:
redraw: chartWidth: 481, docWidth: 768
JS LOG:
redraw: chartWidth: 744, docWidth: 768
JS LOG:
redraw: chartWidth: 744, docWidth: 768
JS LOG:
redraw: chartWidth: 744, docWidth: 768
JS LOG:
redraw: chartWidth: 744, docWidth: 768
JS LOG:
redraw: chartWidth: 744, docWidth: 768
JS LOG:
redraw: chartWidth: 481, docWidth: 768
JS LOG:
redraw: chartWidth: 481, docWidth: 768
JS LOG:
redraw: chartWidth: 744, docWidth: 768
eo_support
Posted: Thursday, April 10, 2014 2:21:36 PM
Rank: Administration
Groups: Administration

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

EO.Pdf does not know when your chart has finished drawing because the drawing is done by JavaScript. JavaScript code can keep running while there is no clear indication of "done" or not. For example, if you have a JavaScript timer that keeps updates the current time on the page, then obviously if EO.Pdf were to wait for the JavaScript to "finish", then it will be sitting there forever. This is when eopdf.convert is useful.

We do resize the browser window after you call eopdf.convert (or automatically shortly after loading completes if you do not use manual trigger). The purpose of this logic is to trying to figure out the best zoom level so that your page can fit into a paper nicely. If you wish to disable that logic, you can set both HtmlToPdf.Options.AutoFitX and
HtmlToPdf.Options.AutoFitY to None. So you might want to give that a try (Make sure you download the latest build. Skipping auto resizing logic when both AutoFitX and AutoFitY are None is only added very recently).

Hope this helps. Please feel free to let us know if you still have any questions.

Thanks!
Droddy
Posted: Thursday, April 10, 2014 2:47:34 PM
Rank: Member
Groups: Member

Joined: 1/22/2014
Posts: 20
Thanks. I already tried that suggestion after reading this: http://www.essentialobjects.com/forum/postst8221_High--Charts-are-not-filling-the-page-width-ScaleToFit-Blank-Page.aspx

What I get when I set AutoFit[X and Y] to None is some charts too large, some barely visible and the console logging shows that EO is still resizing the window twice after the convert command is called manually.

Is this a common problem? Is it possible I have too many highcharts on my pages?
eo_support
Posted: Thursday, April 10, 2014 3:05:05 PM
Rank: Administration
Groups: Administration

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

Make sure that you are running the latest build. If that does not solve the problem, you can try to isolate the problem into a test project and send the test project to us. Please see here for test project guidelines:

http://www.essentialobjects.com/forum/postst8144_Test-project-guidelines.aspx

Let us know once you have the test project and we will PM you as to where to send.

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.