Skip to content

isleofcode/rv-test

Repository files navigation

rv-test

Usage

  • In a Node.js REPL, start a websocket:
const WebSocket = require('ws');
let url = 'file:///path/to/built/glimmer/index.html'
let socket = new WebSocket.Server({
  perMessageDeflate: false,
  port: 8080
});
  • Load up a renderer:
const { Renderer } = require('render-vendor');
Renderer.load(url);
  • Find & render your page's HTML:
let page = Renderer.find(url);

page.render().then((data) => console.log(data));
  • Set a name & render to PDF:
socket.clients.forEach((ws) => ws.send(JSON.stringify({
  name: 'Ember Night'
})));

page.render({ filename: './rv-with-name.pdf' });
  • Set all data & render to PNG:
socket.clients.forEach((ws) => ws.send({
  name: 'Ember Night',
  body: '<img src="http://lorempixel.com/400/200">'
}));

page.render({ filename: './rv-with-img.png' });

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages