react-pdf

Using react-pdf with react-chartjs-2 to generate a pdf

只愿长相守 提交于 2021-01-05 11:32:15
问题 I've looked around quite a bit but I can't seem to find any examples of the use of these 2 libraries together. My project currently uses react-pdf to generate pdf reports but I need to add chartjs charts to some of the new files we'll be generating. I would prefer not to have to use two different pdf libraries and have to re-code parts of the application to match 2 standards. If there is a different library that can get the job done I would be open to suggestions. The page I am trying to

Highcharts-React Get Base64 PNG of chart

可紊 提交于 2020-04-18 03:47:35
问题 I'm looking to pass a chart export to a component that specifically requires PNG or JPG- so an SVG will unfortunately not work. With the help of other SO answers- I was able to get the SVG Base64 using the following code: let link = "data:image/svg+xml;base64," + btoa(this.lineChartRef.current.CHART.current.chart.getSVG()); Is there a way I can get the PNG base64? Or is there an efficient way within React to convert this SVG base64 to a PNG? Thanks!!! 回答1: Thanks to @ppotaczek for his