saveSvgAsPng icon indicating copy to clipboard operation
saveSvgAsPng copied to clipboard

unable to download text and table data using savesvgaspng .

Open Sanjotarm opened this issue 6 years ago • 4 comments

i am able to download the graph using svgid, but unable to download text and table in same file(graph.png). I am using saveSvgaspng.js

downloader(){ saveSvgAsPng(svgid, 'graph.png', {scale:1}, {backgroundColor: transparent}); }

<button onclick={()=>this.downloader()}>Download

Please suggest any thing need to add to get text and table data.

Sanjotarm avatar May 27 '19 13:05 Sanjotarm

Hey @Sanjotarm,

Can you please elaborate on your scenario? Is the text and table data part of the SVG itself or those are separate HTML elements?

It would be great if you could provide a more complete example as well.

ligaz avatar May 28 '19 10:05 ligaz

You would have to build this on your own. This library allows only for exporting SVG elements. This yields that you have two options:

  • Augment the SVG with additional data (text, table data, etc.). Export the SVG. Then remove the augmented elements from the SVG.
  • Use dom-to-image library.

ligaz avatar May 28 '19 12:05 ligaz

hi @ligaz ,

i have tried with dom-to-image library. But i am unable to see table data with exact UI, Once downloading png its compressing the downloaded page(Entire data will display in one page without scroll.).

So please can you suggest if any other library for pdf downloader with text, svg and table data.

i have tried with html2canvas, but svg is downloading with black backgorund color.

So please can you help out to resolve the problem.

Sanjotarm avatar May 29 '19 11:05 Sanjotarm

It looks like your request exceeds the realm of this project. My suggestion is to post your question on StackOverflow where you will get relevant responses.

ligaz avatar May 29 '19 12:05 ligaz