This gem wraps your PDFify API to make it super easy for developers (like vroom) to integrate HTML-to-PDF conversion.
cd pdfify-ruby
bundle installgem build pdfify.gemspecOutput:
Successfully built RubyGem
Name: pdfify
Version: 0.1.0
File: pdfify-0.1.0.gem
gem install ./pdfify-0.1.0.gemStart your PDFify Rails server first:
cd ../pdfify
rails sGet an API token:
cd ../pdfify
rails runner "puts ApiToken.first&.token || 'No tokens found. Create one in the dashboard.'"Run the test script:
cd ../pdfify-ruby
ruby test_example.rbOr test in IRB:
irb
require 'pdfify'
PDFify.configure do |config|
config.api_key = "pfy_test_xxxxxxxx" # Your actual token
config.base_url = "http://localhost:3000"
end
pdf = PDFify.convert(html: "<h1>Hello World!</h1>", test: true)
File.binwrite("test.pdf", pdf)
exitCheck the generated test.pdf file!
-
Create RubyGems account: https://rubygems.org/sign_up
-
Set up credentials:
# Get your API key from https://rubygems.org/profile/edit
curl -u YOUR_USERNAME https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
# Secure it
chmod 0600 ~/.gem/credentialsUpdate gemspec with your details:
Edit pdfify.gemspec:
spec.authors = ["Your Actual Name"]
spec.email = ["[email protected]"]
spec.homepage = "https://github.com/yourusername/pdfify-ruby"
spec.summary = "Ruby client for PDFify HTML-to-PDF API"Check all files are ready:
ls -laYou should see:
- ✓
lib/pdfify.rb - ✓
lib/pdfify/version.rb - ✓
lib/pdfify/configuration.rb - ✓
lib/pdfify/client.rb - ✓
pdfify.gemspec - ✓
README.md - ✓
LICENSE.txt - ✓
CHANGELOG.md - ✓
Gemfile
gem build pdfify.gemspecThis creates pdfify-0.1.0.gem.
gem push pdfify-0.1.0.gemExpected output:
Pushing gem to https://rubygems.org...
Successfully registered gem: pdfify (0.1.0)
Visit: https://rubygems.org/gems/pdfify
You should see your gem listed!
Now ANYONE can install it:
gem install pdfifyOr in a Gemfile:
gem 'pdfify', '~> 0.1.0'When you add new features or fix bugs:
Edit lib/pdfify/version.rb:
module PDFify
VERSION = "0.2.0" # Bump version
endEdit CHANGELOG.md:
## [0.2.0] - 2026-02-15
### Added
- New feature X
- New feature Y
### Fixed
- Bug fix Zgem build pdfify.gemspec
gem push pdfify-0.2.0.gemFormat: MAJOR.MINOR.PATCH
- PATCH (0.1.0 → 0.1.1): Bug fixes, no new features
- MINOR (0.1.0 → 0.2.0): New features, backward compatible
- MAJOR (0.9.0 → 1.0.0): Breaking changes, not backward compatible
Examples:
- Fixed a typo:
0.1.0→0.1.1 - Added webhook support:
0.1.0→0.2.0 - Changed API interface:
0.9.0→1.0.0
If you accidentally published a broken version:
gem yank pdfify -v 0.1.0Warning: Only do this for critical bugs. Users who already installed will keep the old version.
Old (DocRaptor):
# Gemfile
gem 'docraptor'
# config/initializers/docraptor.rb
DocRaptor.configure do |config|
config.username = Rails.application.secrets.DOCRAPTOR_API_KEY
end
# lib/core/pdf_output.rb
docraptor = DocRaptor::DocApi.new
pdf = docraptor.create_doc(
document_content: html,
document_type: "pdf",
test: Rails.env.development?
)New (PDFify):
# Gemfile
gem 'pdfify'
# config/initializers/pdfify.rb
PDFify.configure do |config|
config.api_key = Rails.application.secrets.PDFIFY_API_KEY
config.base_url = "https://api.pdfify.example.com" # Your production URL
end
# lib/core/pdf_output.rb
pdf = PDFify.convert(
html: html,
test: Rails.env.development?
)That's it! Drop-in replacement.
pdfify-ruby/
├── lib/
│ ├── pdfify.rb # Main entry point
│ └── pdfify/
│ ├── version.rb # VERSION constant
│ ├── configuration.rb # Config class
│ └── client.rb # HTTP client
├── pdfify.gemspec # Gem metadata
├── Gemfile # Development dependencies
├── README.md # Full documentation
├── LICENSE.txt # MIT license
├── CHANGELOG.md # Version history
├── QUICK_START.md # This file
└── test_example.rb # Test script
Generated when you build:
├── pdfify-0.1.0.gem # The actual gem file
- Tested locally with
ruby test_example.rb - Updated version in
lib/pdfify/version.rb - Updated
CHANGELOG.md - Updated author/email in
pdfify.gemspec - Created RubyGems account
- Set up
~/.gem/credentials - Built gem:
gem build pdfify.gemspec - Ready to push:
gem push pdfify-0.1.0.gem
Make sure you installed it:
gem install ./pdfify-0.1.0.gemMake sure your PDFify server is running:
cd pdfify
rails sGet a token from your Rails app:
cd pdfify
rails runner "puts ApiToken.first.token"Check your credentials:
cat ~/.gem/credentials
chmod 0600 ~/.gem/credentialsChoose a different name in pdfify.gemspec:
spec.name = "pdfify-client" # Or something unique- ✓ Build the gem locally
- ✓ Test it with your PDFify server
- ✓ Publish to RubyGems.org
- ✓ Integrate into vroom to replace DocRaptor
- ✓ Save $600-3,400/year!
- Share with the community
- RubyGems Guides: https://guides.rubygems.org/
- Semantic Versioning: https://semver.org/
- Gem Best Practices: https://guides.rubygems.org/patterns/
- Publishing Guide: https://guides.rubygems.org/publishing/
You're all set! Happy gem building!