0

I have a problem. I am making something like a coloring book and I make it working on SVG images. When user have already painted this image I need to provide him download this with posibility of print. So user has to download it as a PDF file. I have already made downloading as a SVG file, but I have problem with converting it to the PDF file. Can you help me?

download = () => {
        var svgData = $("#esfalgie")[0].outerHTML;
        var svgBlob = new Blob([svgData], {type:"image/svg+xml;charset=utf-8"});
        var svgUrl = URL.createObjectURL(svgBlob);
        console.log(svgData);
        var downloadLink = document.createElement("a");
        downloadLink.href = svgUrl;
        downloadLink.download = "newesttree.svg";
        document.body.appendChild(downloadLink);
        downloadLink.click();
        document.body.removeChild(downloadLink);
    }
Radagast the Brown
  • 3,156
  • 3
  • 27
  • 40
  • Does this answer your question? [Generating PDF files with JavaScript](https://stackoverflow.com/questions/742271/generating-pdf-files-with-javascript) – thchp Oct 12 '21 at 11:53
  • Maybe use something like [SVG2PDF](https://github.com/yWorks/svg2pdf.js/) to create your pdf for download? – Steve -Cutter- Blades Oct 12 '21 at 12:39

0 Answers0