RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

✨ Generate PDFs in pure Ruby using Chrome — no Selenium, Puppeteer, or Node required

Just published a new proof of concept gem: bidi2pdf — a pure Ruby tool for generating high-quality PDFs using Chrome’s new WebDriver BiDi protocol. 🛠 What it does:

Renders web pages to PDF using Chrome’s native print API

Connects to Chrome via BiDi WebSocket — no browser automation stack needed

Supports cookies, headers, basic auth, and more

Includes a CLI:

bidi2pdf render --url <https://example.com> --output file.pdf

🚫 What it doesn’t need:

❌ Selenium

❌ Puppeteer

❌ Node.js

✅ Just chromedriver and Ruby 3.3+

It’s still an early-stage proof of concept, but works great in Docker and CI pipelines. No Node stack, no JS glue — just Ruby & BiDi-Protocall all the way down.

👉 Source + usage: github

👉 Install: gem install bidi2pdf

Would love feedback if you try it, break it, or want to extend it 💬

Comments

How does this compare to ruby-ferrum? https://github.com/rubycdp/ferrum - Is the BiDi approach faster (benchmarks?)? More memory efficient?

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in