Suggestion on how to create vector image/pdf for chart on server side

Thread is closed for posting
3 posts, 0 answers
  1. Raghu
    Raghu avatar
    4 posts
    Member since:
    May 2014

    Posted 07 Jul 2014 Link to this post


    Can you please provide some suggestion on creating a chart on server side and export SVG out of it to create vector graphics/pdf.

    We have an application which runs as a scheduler on the server, generates charts and emails them to customers in PDF/Images. All this without any manual interaction.

    I looked at RadChart and RadHTMLChart. RadChart is a server side compontent but can't export vercor graphics, and RadHtmlChart renders SVG strictly the on browser.

    The problem with using RadHtmlChart is we have to run a browser object from server side code to execute JS which can be a 'not so' reliable solution.

    Please suggest. Thanks!
  2. Marin Bratanov
    Marin Bratanov avatar
    3899 posts

    Posted 08 Jul 2014 Link to this post

    Hello Raghu,

    RadHtmlChart renders with JavaScript in the browser, so you need to run it in a browser context in order for it to render. At this point you can access the SVG string that it generates and use it.

    On RadChart export - it has never been intended to work with vector graphics and produces only raster images, so you may need to go with the RadHtmlChart.

    You can find example of exporting it here: It uses a third party tool (in this case Inkscape) to generate a PDF or PNG from the SVG string. Depending on your needs, you may need to tweak it.

    On avoiding user interaction - you would, indeed, need to run the browser on the server in order to get the rendered HtmlChart. You can consider using other tools to run the browser and get the needed data, like PhantomJS:

    Whether this is a reliable solution - I do not see reasons why it would break, especially if the code that runs the browser instance cleans up after itself (i.e., closes the browser). All export operations put load on the server, yet running a browser with one or a couple of charts should not slow it down significantly, generating a large PDF is likely to require more memory and resources. If this is still not an option, you could consider requiring user interaction so that the charts render on the client's browsers and they only send you back the SVG string.


    Marin Bratanov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Raghu
    Raghu avatar
    4 posts
    Member since:
    May 2014

    Posted 08 Jul 2014 in reply to Marin Bratanov Link to this post

    Thanks Marin!

    Yes, I did review the forums and some examples already. I'm currently using Gecko engine to make the browser request from server.
    I was basically looking to see if I missed any existing feature on server side to get SVG, or any newly planned feature coming up.

    Also, on a side note the search feature seems to be broken in forums. The search is not yielding any results.

    Just fyi...

Back to Top