-
-
Save adamdyson/852291b64a98fd287554 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prince http://127.0.0.1/phantomjs/index.php --javascript -o generated.pdf | |
RESULT: | |
prince: https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.9.23/paper-core.js:181: error: TypeError: object is not a function | |
prince: http://127.0.0.1/phantomjs/index.php:8: error: TypeError: undefined value is not an object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Modify SVG</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.9.23/paper-core.js"></script> | |
<style type="text/css"> | |
html | |
{ | |
width: 100%; | |
height: 100%; | |
} | |
body | |
{ | |
margin: 0px 0px 0px 0px; | |
padding: 0px 0px 0px 0px; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="container"> | |
</div> | |
</body> | |
<script> | |
(function($) | |
{ | |
// Create a canvas element | |
var canvas = document.createElement('canvas'); | |
// Create a paper scope object | |
var scope = new paper.PaperScope(); | |
// Set up an empty project and default layer | |
scope.setup(canvas); | |
// Set the view size | |
scope.view.viewSize = new scope.Size(377.952755906, 793.700787402); // 100mm x 210mm | |
// Retrieve the default layer | |
var surface = scope.project.activeLayer; | |
// Rename the default layer | |
surface.name = 'surface'; | |
var size = scope.view.viewSize; | |
var position = new scope.Point(0, 0); | |
var rectangle = new scope.Rectangle(position, size); | |
var path = new scope.Path.Rectangle(rectangle); | |
path.fillColor = '#FF00FF'; | |
$('#container').append(scope.project.exportSVG()); | |
} | |
)(jQuery); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment