Skip to content

Instantly share code, notes, and snippets.

var page = require('webpage').create(),
system = require('system'),
address, output, size;
if (system.args.length < 3 || system.args.length > 5) {
console.log('Usage: rasterize.js URL filename [paperwidth*paperheight|paperformat] [zoom]');
console.log(' paper (pdf output) examples: "5in*7.5in", "10cm*20cm", "A4", "Letter"');
console.log(' image (png/jpg output) examples: "1920px" entire page, window width 1920px');
console.log(' "800px*600px" window, clipped to 800x600');
<div id="savage-editor" style="height: 500px;width:100%;"></div>
<!-- optionally we'll put two buttons here to transfer the content to some JSON ! (note: using bootstrap layout here)-->
<button id='savage-editor-get-json' type='button' class='btn btn-default'>Get JSON</button>
<button id='savage-editor-load-json' type='button' class='btn btn-default'>Load JSON</button>
<script src="raphael.savage.js" ></script>
<script type="text/javascript">
$(function() {
// Connect the div to a Savage.Editor instance.
var savageEditor = new Savage.Editor("savage-editor");
// When the get json button is clicked:
$("#savage-editor-get-json").on("click", function(){
var jsonRepresentation = savageEditor.saveToJSON();
// jsonRepresentation will now contain the full svg data of the editor. You could store this in a database.
Batistleman / meteor_migration.js
Last active August 29, 2015 14:06
Meteor Migration Proposal
Post = new SimpleSchema({
version: 1,
title: {
type: String,
label: "Title",
max: 200