jQuery Plugin To Export Canvas Using File Download Dialog - ExportCanvas
| File Size: | 11.5 KB |
|---|---|
| Views Total: | 2560 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
ExportCanvas is an easy-to-use JavaScript library which allows you to export canvas objects using browser file download dialog.
How to use it:
1. Load jQuery library and the exportcanvas.js script in the html document.
<script src="jquery.min.js"></script> <script src="core/export-canvas.js"></script>
2. Usage.
// The ID of canvas element you want to export
var exampleCanvasID = "myCanvas";
var exportCanvas = new ExportCanvas();
// Load the config & language javascript files
exportCanvas.loadConfigFile("core/config/config.js");
exportCanvas.loadLanguageFile("core/language/de.js");
// Set the MIMEType
exportCanvas.setMimeType("image/jpeg");
// Set the quality level when exporting (0.1 - 1.0)
exportCanvas.setExportQuality(1.0);
// The export method
exportCanvas.export(exampleCanvasID, function() {
// callback function
}, function(getLastReport) {
// callback function fired after the download has failed
});
// Export canvas without callbacks
exportCanvas.export(exampleCanvasID);
// Export canvas on document ready
window.onload = function() {
exportCanvas.export(exampleCanvasID);
This awesome jQuery plugin is developed by onur-sahin-de. For more Advanced Usages, please check the demo page or visit the official website.











