In my web application, the user is able to draw some objects. The drawing functionality is implemented (at client-side) using d3js (SVG). The attributes of the objects (shape, coordinates, colours) are saved at server-side in a structured database.
Now, I need to render the drawings at server-side as well. I would like to reuse (at server-side) the rendering logic implemented at client-side. That is, to obtain a SVG (then convert it to PNG / PDF), given the object attributes saved in the database.
I see (at least) the following options:
- install NodeJS on Heroku as well, and execute node from my Python web application. This would require JSDOM if I understood well - see this;
- use ghost.py to open a local HTML file that does the actual rendering (using d3js);
- send the rendered SVG from client-side to the back-end - this is a poor choice, though.
What is your recommendation?
Later edit
Ghost.py
is not an option, since it requires PyQt or PySide, neither of which can be installed on Heroku. See this.
PhantomJS
seems a great choice.
Some references