require "docraptor" DocRaptor.configure do |config| config.username = "YOUR_API_KEY_HERE" # this key works in test mode! end docraptor = DocRaptor::DocApi.new begin # different method than the non-hosted documents response = docraptor.create_hosted_doc( test: true, # test documents are free but watermarked document_type: "pdf", document_content: "Hello World!", # document_url: "http://docraptor.com/examples/invoice.html", # javascript: false, ) puts "The PDF is hosted at #{response.download_url}" rescue DocRaptor::ApiError => error puts "#{error.class}: #{error.message}" puts error.code puts error.response_body puts error.backtrace[0..3].join("\n") end