https://github.com/synesenom/dl
Download helper for SVG graphics
https://github.com/synesenom/dl
eps export pdf svg
Last synced: 16 days ago
JSON representation
Download helper for SVG graphics
- Host: GitHub
- URL: https://github.com/synesenom/dl
- Owner: synesenom
- Created: 2016-12-01T10:22:35.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-24T09:11:40.000Z (about 9 years ago)
- Last Synced: 2025-11-11T01:18:12.713Z (8 months ago)
- Topics: eps, export, pdf, svg
- Language: JavaScript
- Homepage:
- Size: 2.84 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/synesenom/dl)
# Description
Library for exporting SVG content from the DOM.
# Requirements
`d3`
# Limitations
Only works with styles defined inline in the SVG for every single element.
# API reference
- [png](#png)
- [eps](#eps)
- [json](#json)
## png
```
dl.png(svg, filename, options)
```
Exports a specific SVG content as a PNG image.
| argument | description |
| --- | --- |
| `svg` | Selector for the SVG element to export, either the SVG element itself, its ID or class. |
| `filename` | Name of the exported PNG. |
| `options` | Additional options for the PNG. Possible keys: `width`, `height`. |
## eps
```
dl.eps(svg, filename)
```
Exports a specific SVG content as an EPS image.
Supported shapes: `line`, `circle`.
Transparency is not supported, only alpha-blending with background.
| argument | description |
| --- | --- |
| `svg` | Selector for the SVG element to export, either the SVG element itself, its ID or class. |
| `filename` | Name of the exported EPS. |
## json
```
dl.json(svg, filename)
```
Exports the specified SVG content to a graph JSON file.
The SVG content is expected to be a network drawn with d3, that is, only `circle` and `line` elements are exported.
| argument | description |
| --- | --- |
| `svg` | Selector for the SVG element to export, either the SVG itself, its ID or class. |
| `filename` | Name of the exported JSON. |