Skip to content

Instantly share code, notes, and snippets.

@gka
Created March 22, 2012 18:44
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gka/2161580 to your computer and use it in GitHub Desktop.
Save gka/2161580 to your computer and use it in GitHub Desktop.
Rendering a Kartograph map to PDF using PhantomJS
var page = new WebPage(),
url = "http://kartograph.org/showcase/italia/",
output = "italia.pdf";
page.viewportSize = { width: 1100, height: 750 };
page.open(url, function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
} else {
window.setTimeout(function () {
page.render(output);
phantom.exit();
}, 200);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment