Project

docraptor

0.04
No release in over a year
A native client library for the DocRaptor HTML to PDF/XLS service.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

~> 4.4, >= 4.4.6
~> 0.2, >= 0.2.12
~> 0.2, >= 0.2.16
~> 4.1, >= 4.1.2
~> 0.10, >= 0.10.4
~> 11.2, >= 11.2.2
~> 3.6, >= 3.6.0
~> 3.0, >= 3.0.1
~> 1.24, >= 1.24.3

Runtime

~> 1.0, >= 1.0.1
~> 2.3, >= 2.3.0
~> 2.1, >= 2.1.0
 Project Readme

DocRaptor Ruby Native Client Library

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

Installation

Add the following to your Gemfile.

gem "docraptor"

Then run:

bundle install

Basic Usage

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

$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
  # },
)

Next Steps

  • Optionally store and get a URL for your converted document with document hosting
  • View more code examples with error handling, asynchronous creation, file saving, and document hosting.
  • Perfect your document styling with our style and formatting reference, and API reference. Easily add headers and footers, page breaks, page numbers, table of contents, and much more!

More Help

Stuck? We're experts at turning HTML into PDFs so please email us if you run into trouble.

Development

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
  1. Update CHANGELOG.md
  2. Commit "Release version vX.Y.Z"
  3. rake release
  4. Verify package release at https://rubygems.org/gems/docraptor
  5. Refresh documentation on docraptor.com

Version Policy

This library follows Semantic Versioning 2.0.0.