HTML to PDF with Ruby and Puppeteer

Install Puppeteer and Grover

npm i puppeteer
gem install grover

Convert HTML to PDF and save to file

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

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.