Giter Site home page Giter Site logo

sharonchoong / svg-exportjs Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 21.0 222 KB

A Javascript library to export svg charts from the DOM and download them as an SVG file, PDF, or raster image (JPEG, PNG) format. Can be done all in client-side.

License: MIT License

HTML 24.00% JavaScript 76.00%
d3js download export javascript jpeg pdf png svg visualization

svg-exportjs's People

Contributors

codacy-badger avatar sharonchoong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

svg-exportjs's Issues

Slight error in color in downloadJpeg

I'm using svg-export for exporting in various formats, and, coming from the same SVG object with color #007bc4 the color in JPG is instead #017bc4. It doesn't happen when exporting a PNG or when saving the SVG, of course.
It's a very slight difference (I cannot see it with my own eyes in a well-calibrated monitor) but it's there nonetheless.

What can be the reason? Any ideas? Thanks!

Host on CDN?

Great library! I was just wondering if you would consider hosting the script on a proper cdn like cdnjs or jsDelivr so that I could properly tag my imports with versions and benefit from their dedicated javascript caching?

'downloadJpeg' is not exported from

I've been struggling with using this package in my React project.
I downloaded the min.js file and added it to my project. Locally all works fine, but in the container I get the following error.
Attempted import error: 'downloadJpeg' is not exported from '../../svg-export.min.js' (imported as 'svgExport').
and similar, depending on the attempt.
I am sure the path is set right,
import * as svgExport from '../../svg-export.min.js';

I am out of clues. It would be really appreciated if clues are given. Thank you!

Not working for SVG Pattern

First of all, its wonderful app...
But, Its not working while exporting a PDF, When we use a SVG pattern example this pattern:

<svg id="mysvg" xmlns="http://www.w3.org/2000/svg" width="595.28" height="841.89"> <pattern width="40" height="40" patternUnits="userSpaceOnUse" id="a" viewBox="0 -40 40 40" overflow="visible"> <path fill="none" d="M0 0h40v-40H0z"/> <path fill="#1D0E82" d="M0-40v20h20v-20zM20-20V0h20v-20z"/> </pattern> <g fill="#1D0E82"> <path d="M457-99h20v20h-20zM477-79h20v20h-20z"/> </g> <path fill="url(#a)" d="M0 0h595.28v841.89H0z"/> </svg>

Any help will be appreciated..
Thanks

svg export removed foreignObject, How can fix that ?

<svg id="mysvg" height="400" width="100%"> <g class="rects"> <rect x="300" y="40" width="40" height="40" fill="black" stroke="black"></rect> <rect x="50" y="100" width="500" height="200" fill="orange" stroke="gray" opacity="0.5"></rect> </g> <g class="circles"> <circle cx="100" cy="100" r="100" fill="green" stroke="yellow" opacity="0.2"></circle> <circle cx="200" cy="100" r="50" fill="#778899" stroke="blue" opacity="0.5"></circle> <circle cx="400" cy="200" r="150" fill="transparent" stroke="currentColor" opacity="0.8"></circle> </g> <text x="200" y="200" style="font-family: 'Segan', Arial;" font-size="20">Testing 123</text> <foreignObject x="100" y="25" width="160" height="160"> <div> <br><br>GEEKSFORGEEKS<br><br> </div> </foreignObject> </svg>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.