paper.js/examples/SVG Import/From File.html

31 lines
937 B
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html>
<head>
2014-08-16 13:24:54 -04:00
<meta charset="UTF-8">
<title>Import From File</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper-full.js"></script>
<script type="text/paperscript" canvas="canvas">
var file = document.getElementById('file');
file.addEventListener('change', function (event) {
var files = event.target.files;
for (var i = 0; i < files.length; i++) {
var file = files[i];
if (file.type.match('svg')) {
project.clear();
2014-08-16 13:24:54 -04:00
project.importSVG(file, function(item) {
console.log(item);
});
}
}
});
</script>
</head>
<body>
2014-08-16 13:24:54 -04:00
<form>
<input type="file" id="file">
</form>
<canvas id="canvas" width="1000" height="1000"></canvas>
</body>
</html>