Search code examples
javascriptanychartanychart-8.2

How to get chart as image without download it using anychart?


I'm a beginner with anychart library. I'm trying to get the chart as image and insert it inside a pdf. I know that anychart has the following function to download the chart as pdf.

chart.saveAsPdf({"filename": id_container});

However I need to customize my pdf with jsPDF.

The method

chart.saveAsJpg({"filename": id_container});

automatically download the image. I'm using the 8.7.1 version.


Solution

  • You can get the char image as base64 encoded string without downloading it. Check the getJpgBase64String() function.