HTML to PNG with Ruby and Puppeteer

Install Puppeteer and Grover

npm i puppeteer
gem install grover

Convert HTML to PNG and save to file

require 'grover'"html.png", "wb") do |f|
  f.write('<html><body><h1>Hello World</h1></body></html>').to_png)

Find out how to take a retina screenshot with Ruby and Puppeteer.

We created Urlbox to make converting HTML to images easy

Learn more about our website screenshot API.