Skip to content

Svg isn't drawn #2157

@eyaylagul

Description

@eyaylagul

Are you using the latest version of jsPDF?
1.4.1

Have you tried using jspdf.debug.js?
Yes

Steps to reproduce
https://jsbin.com/rayizodoxi/edit?html,js,output

What I saw
Blank page

What I expected
Drawn svg

Hi, i want to create pdf from svg. I have sample svg code

<svg height="500" version="1.1" width="500" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;">
 <desc style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">Created with Raphaël 2.1.0</desc>
 <defs style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></defs>
 <text x="50" y="50" text-anchor="middle" font="10px &quot;Arial&quot;" stroke="none" fill="#000000" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font: 10px Arial;" stroke-width="0.1155822959137042" transform="matrix(8.6436,-0.3768,0.3768,8.6436,-311.9625,-338.3442)">
  <tspan dy="3.5" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">TEXT</tspan>
 </text>
</svg>
var doc = new jsPDF('l', 'px', 'a4');
var svg = '<svg height="500" version="1.1" width="500" xmlns="http://www.w3.org/2000/svg" style="overflow: hidden; position: relative;"><desc style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">Created with Raphaël 2.1.0</desc><defs style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></defs><text x="50" y="50" text-anchor="middle" font="10px &quot;Arial&quot;" stroke="none" fill="#000000" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0); text-anchor: middle; font: 10px Arial;" stroke-width="0.1155822959137042" transform="matrix(8.6436,-0.3768,0.3768,8.6436,-311.9625,-338.3442)"><tspan dy="3.5" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);">TEXT</tspan></text></svg>';
doc.addSVG(svg, 0, 0, 500, 500);
doc.save('Test.pdf');

i use addSvg method for pdf create. But pdf export blank page.

Where am i doing wrong?

Thank You.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions