Skip to content

Mini library, with no dependencies, to output PNGs from maps and reports (or anything in the DOM)

License

Notifications You must be signed in to change notification settings

HuasoFoundries/front_screenshot

Repository files navigation

Front Screenshot

Build Status

This library bundles

Into an library with no dependencies, that can transform SVG elements into images or Canvas elements, and take screenshots of your page or sections of it, even if they are hidden due to CSS properties such as overlay scroll, hidden or auto.

Why?

Basically, because chart libraries such as C3.js can style SVG elements with rotation and other transformations that HTML2Canvas cannot parse. So I combined its features with the ones on Canvg to preprocess a given container, transforming each SVG element into an image, then capturing the screenshot, then restoring the original SVG.

Some additions and removal of properties, attributes and classnames where cumbersome to add using native document.querySelectorAll methods, so I also bundled Cash.js, a minimal jQuery alternative that provides just what's needed to manipulate DOM nodes.

Example

See the online example at: https://huasofoundries.github.io/front_screenshot/

Or, you can also clone this repo, run make install, then make run from its root and navigate to http://localhost:5000.

git clone https://github.com/HuasoFoundries/front_screenshot.git
cd front_screenshot
make install
make run

API

See USAGE.md

Install

Install it with

npm install front_screenshot

or, if you're using JSPM:

jspm install front_screenshot=npm:front_screenshot
jspm install front_screenshot=github:HuasoFroundries/front_screenshot

About

Mini library, with no dependencies, to output PNGs from maps and reports (or anything in the DOM)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published