Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't render <image> in output #8

Open
psimyn opened this issue Dec 2, 2015 · 1 comment
Open

Doesn't render <image> in output #8

psimyn opened this issue Dec 2, 2015 · 1 comment

Comments

@psimyn
Copy link

psimyn commented Dec 2, 2015

Using a data-uri as xlink:href, I am able to render/return an svg, which I can convert to png successfully using convert in shell. But when calling render the image disappears, with apparently no errors.

var svg = ' \
    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100" height="100"> \
      <image xlink:href="data:image/jpg;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==" x="0" y="0" width="100" height="100" /> \
    </svg>';

// this returns a working image
// res.set('Content-Type', 'image/svg+xml');
// return res.send(svg);

res.set('Content-Type', 'image/png');
var newsvg = new Rsvg(svg);

var svgString = newsvg.render({
  format: 'png',
  width: 100,
  height: 100
}).data;

return res.send(svgString);

Happy to know if I am doing something completely wrong

Thanks!

@lavkesh1608
Copy link

Hi , please make sure you have valid svg data string. Its working as i copied directly from browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants