views:

101

answers:

1

I am using reportlab in python to render a pdf server side.

I really like the look of highcharts graphs. But I am building a pdf server side which needs to include some graphs. The server side graphing (reportlab and matplotlib) do not have nearly as much choices for formatting / design.

Is there a way I can run a client side javascript graphing solution (highcharts) from the server side?

Here is a post with that request and this is what they said: You feed this Java tool a URL, it fires up its internal WebKit browser, executes the JavaScript code and dumps the rendered page to PDF.

I am looking for resources on how this could be accomplished in python.

A: 
  1. Open a web browser on the server.

  2. Point the web browser at a pre-made page that loads highcharts and renders your chart.

  3. Grab the output of the browser.

  4. Send that to a client.

Which of those steps seems confusing?

Note that this will be significantly slower than just using matplotlib, because you need to start up a full web browser just to render a graph. I had a quick look at the highcharts page you linked and I think you could probably reproduce that in matplotlib.

katrielalex
I will see about reproducing that in matplotlib.
jhanifen
P.S. specifically which step seemed confusing #2. I have not ran a browser from the server, rendered content and saved it locally before.
jhanifen
It should be the same as doing it locally, depending on the server. You could use something like `selenium` or even `pywin32` (on Windows, naturally) to open the browser.
katrielalex