EasyPDFCloud
easypdfcloud.com provides a RESTful API for accessing
This branch supports version 1 of api.easypdfcloud.com.
This gem assumes you've gone through the OAuth process and have a refresh token.
The easypdfcloud.com access token expires in an hour so this gem requires a refresh token to be configured
so it can automatically refresh when needed.
Configuration:
client_id: '...'
client_secret: '...'
workflow_id: '0000000000000001'
refresh_token: '...'
version: 'v1'
Usage:
pdf_cloud_config = YAML.load_file(File.join(Rails.root, "config", "easypdfcloud.yml"))
pdf_cloud = EasyPdfCloud::Client.new(pdf_cloud_config)
# Local File System conversion. Uses configured workflow id.
out_filepath = pdf_cloud.convert("/path/to/filename.pdf", 'pdf', 'doc')
# Optionally pass a workflow id
out_filepath = pdf_cloud.convert("/path/to/filename.pdf", 'pdf', 'doc', workflow_id)
# Raw Data transform
pdf_data = File.open("somefile.pdf") { |f| f.read }
# This method uses the configured workflow id.
doc_data = pdf_cloud.pdf2word("#{Time.now.to_i}.pdf", pdf_data)
File.open('test.doc', 'wb') {|f| f.write(doc_data)}
Installation
Add this line to your application's Gemfile:
gem 'easy_pdf_cloud'
And then execute:
$ bundle
Or install it yourself as:
$ gem install easy_pdf_cloud
Usage
client = EasyPdfCloud::Client.new(client_id, client_secret, access_token)
puts client.workflows
client.workflow(workflow_id).convert(filename, 'pdf', 'doc')
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request