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
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'); | |
phantom.exit(1); |
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
<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. |
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
<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> |
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
Post = new SimpleSchema({ | |
version: 1, | |
title: { | |
type: String, | |
label: "Title", | |
max: 200 | |
} | |
}); | |
Migrations.add({ |