Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
jsPDF not taking svg as DOM element

I am using jsPDF in React js. I am crating some content and drawings inside a <svg>. When I want to render the pdf, everything inside the SVG is not rendered. Is there any solution to solve this or another one to export the SVG to pdf? I want the text inside the pdf to be selectable as well, I don't want just to transform the SVG into a picture and drop it into a pdf, that is not a solution. Below is my code that is not working

import React from 'react'
import jsPDF from 'jspdf'
const About = () => {

const downloadPDF = () => {
        let doc = new jsPDF("p","pt","a4")
        doc.html(document.querySelector("#graph"), {
            callback: function(pdf){
                pdf.save("doc.pdf");
            }
        })
    }
 return (
         <div id = "graph">
            Some text // {/*This is rendered */}
            <h1>some title</h1> {/*This is rendered */}
            <svg  width="500" height="500"> {/*This is not rendered */}
                <circle cx="50" cy="80" r={radius} stroke="rgb(0,125,225)" stroke-width="2" fill="red"/>
            </svg>
         </div>
  )
}

export default About
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!