SVG-to-PDFKit icon indicating copy to clipboard operation
SVG-to-PDFKit copied to clipboard

Doesn't work in IE11 (parseXML warning)

Open romanlex opened this issue 6 years ago • 3 comments

Hello, I have this meta for my svg

  <svg
    xmlns="http://www.w3.org/2000/svg"
    xlink="http://www.w3.org/1999/xlink"
    version="1.1"
    id="certificatePortraitTemlate"
    width="794"
    height="1123"
    viewBox="0 0 794 1123"
    xmlSpace="preserve"
    orientation="portrait"
  >

And with attributes xmlns and xlink converting to pdfkit doesn't work. PDF is empty

image

When I remove xmlns and xlink all work properly as expected

image

I found what it's tags need be removed when svg is parsed on IE https://github.com/canvg/canvg/issues/189

romanlex avatar Apr 13 '18 10:04 romanlex

Can you attach the entire SVG?

alafr avatar Apr 13 '18 16:04 alafr

https://gist.githubusercontent.com/romanlex/1a8de85cc6444e90f0906f5b2acc5a55/raw/a1d3de4fc14fae1c7ffc00d896c384d454b1d777/exmaple.svg this svg without xmlns and xlink Add it for testing

romanlex avatar Apr 16 '18 15:04 romanlex

It appears that IE adds the xmlns attribute twice, which makes the svg invalid according to the specification. The workaround is to remove it from the string (replace it with empty string)

alafr avatar Apr 24 '18 12:04 alafr