question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
Uzlopakcommented, Dec 19, 2018
1reaction
Uzlopakcommented, Dec 19, 2018

I can understand, but addSVG is really not a good choice. Should be considered as deprecated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML SVG Not Drawing (Works in Other Pages)
I can get the right HTML code to be injected into the HTML page, but no circle/svg is drawn.
Read more >
Paths - SVG: Scalable Vector Graphics - MDN Web Docs
A good understanding of paths is important when drawing SVGs. While creating complex paths using an XML editor or text editor is not...
Read more >
SVG Logo not visible | WordPress.org
I am unable to use a svg image as the site logo. When I inspect element the site, I see the logo is...
Read more >
The follow svg not visible in android · Issue #1127 - GitHub
The following Svg component becomes invisible in 9.9.9 version and this svg is visible in 9.5.1.
Read more >
4. Basic Shapes - SVG Essentials, 2nd Edition [Book] - O'Reilly
SVG lets you draw a straight line with the <line> element. ... The SVG in Example 4-1 draws several lines; the reference grid...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found