
How to take screenshots and generate PDFs in Ruby on Rails
How to Take Screenshots and Generate PDFs in Ruby on Rails Rails developers have a few standard options for PDF generation: WickedPDF (wraps wkhtmltopdf), PDFKit (same), Prawn (draws PDFs programmatically), or Grover (wraps Puppeteer). Each adds a system dependency, a binary, or a Node.js runtime to your stack. For screenshots there's no clean native option — most teams end up shelling out to Chrome. Here's the alternative: one HTTP call, binary response, no system dependencies. Screenshot from a URL require 'net/http' require 'json' require 'uri' def screenshot ( url ) uri = URI ( 'https://pagebolt.dev/api/v1/screenshot' ) http = Net :: HTTP . new ( uri . host , uri . port ) http . use_ssl = true request = Net :: HTTP :: Post . new ( uri ) request [ 'x-api-key' ] = ENV [ 'PAGEBOLT_API_KEY' ] request [ 'Content-Type' ] = 'application/json' request . body = { url: url , fullPage: true , blockBanners: true }. to_json response = http . request ( request ) response . body end # Save to dis
Continue reading on Dev.to Webdev
Opens in a new tab

![[MM’s] Boot Notes — The Day Zero Blueprint — Test Smarter on Day One](/_next/image?url=https%3A%2F%2Fcdn-images-1.medium.com%2Fmax%2F1368%2F1*AvVpFzkFJBm-xns4niPLAA.png&w=1200&q=75)

