A native Ruby client for the DocRaptor document generation service.
Ruby Shell
Latest commit f937770 Nov 3, 2016 @esquivalient esquivalient committed on GitHub Reminder to verify package release
Failed to load latest commit information.
script Latest swagger command from upstream. Oct 18, 2016
test Rename ClientApi to DocApi. Jan 30, 2016
.gitignore Build directory should be git ignored. Jan 14, 2016
.swagger-revision Moved swagger revision into language repo for easy overriding. Mar 11, 2016
CHANGELOG.md Release version v1.1.0 Nov 3, 2016
Gemfile Hoist client out of subdir. Jan 14, 2016
README.md Reminder to verify package release Nov 3, 2016
docraptor.gemspec Rename ClientApi to DocApi. Jan 30, 2016
swagger-config.json Release version v1.1.0 Nov 3, 2016


DocRaptor Ruby Native Client Library

This is a Ruby gem for using DocRaptor API to convert HTML to PDF and XLSX.


Add the following to your Gemfile.

gem "docraptor"

Then run:

bundle install


See examples for runnable examples with file output, error handling, etc.

DocRaptor.configure do |dr|
  dr.username = "YOUR_API_KEY_HERE" # this key works for test documents
  # dr.debugging = true

$docraptor = DocRaptor::DocApi.new

response = $docraptor.create_doc(
  test:             true,                                         # test documents are free but watermarked
  document_content: "<html><body>Hello World</body></html>",      # supply content directly
  # document_url:   "http://docraptor.com/examples/invoice.html", # or use a url
  name:             "docraptor-ruby.pdf",                         # help you find a document later
  document_type:    "pdf",                                        # pdf or xls or xlsx
  # javascript:       true,                                       # enable JavaScript processing
  # prince_options: {
  #   media: "screen",                                            # use screen styles instead of print styles
  #   baseurl: "http://hello.com",                                # pretend URL when using document_content
  # },

Docs created like this are limited to 60 seconds to render, check out the async example which allows 10 minutes.

We have guides for doing some of the common things:

More Help

DocRaptor has a lot of more styling and implementation options.

Stuck? We're experts at using DocRaptor so please email us if you run into trouble.


The majority of the code in this repo is generated using swagger-codegen on docraptor.yaml. You can modify this file and regenerate the client using script/generate_language ruby.

Release Process

  1. Pull latest master
  2. Merge feature branch(es) into master
  3. script/test
  4. Increment version in code:
    • swagger-config.json
    • lib/docraptor/version.rb
  5. Update CHANGELOG.md
  6. Commit "Release version vX.Y.Z"
  7. rake release
  8. Verify package release at https://rubygems.org/gems/docraptor
  9. Refresh documentation on docraptor.com

Version Policy

This library follows Semantic Versioning 2.0.0.