Convert SVG to PNG and maintain CSS integrity

后端 未结 3 1044
眼角桃花
眼角桃花 2021-01-04 13:56

I am currently using canvg() and Canvas2Image to copy my SVG to a canvas and then convert the canvas to PNG. I would like to maintain the image format and not use PDF.

3条回答
  •  时光说笑
    2021-01-04 14:05

    The key thing here is that all the style rules need to be part of the SVG, not in external style files. So you would need to go through all the CSS for NVD3 and set all of those attributes in the code. Anything that is set via an external stylesheet will be ignored.

提交回复
热议问题