Skip to Content

Ruby

Official Ruby SDK for TemplateFox.

Gem Version GitHub Repository 

Installation

Add to your Gemfile:

gem 'templatefox'

Then run:

bundle install

Or install directly:

gem install templatefox

Generate a PDF

require 'templatefox' # Initialize the client TemplateFox.configure do |config| config.api_key['ApiKeyAuth'] = 'your-api-key' end api = TemplateFox::PDFApi.new # Generate a PDF request = TemplateFox::CreatePdfRequest.new( template_id: 'YOUR_TEMPLATE_ID', data: { name: 'John Doe', invoice_number: 'INV-001', total_amount: 150.00 } ) begin response = api.create_pdf(request) puts "PDF URL: #{response.url}" puts "Credits remaining: #{response.credits_remaining}" rescue TemplateFox::ApiError => e puts "Error: #{e.message}" end

Configuration

TemplateFox.configure do |config| config.api_key['ApiKeyAuth'] = ENV['TEMPLATEFOX_API_KEY'] end

Full SDK Reference

For the complete API coverage including templates, account, S3 integration, and error handling, see the GitHub repository README .

Last updated on