CloudConvertMergePDF is a ruby wrapper for the Cloud Convert combine files to pdf API. The CloudConvert combine to pdf API merge files of any supported file type to a single PDF file.
Add this line to your application's Gemfile:
gem 'cloud_convert_merge_pdf'
And then execute:
$ bundle
Add the following to an initializer file.
CloudConvertMergePdf.configure do |config|
config.api_key = "YOUR CLOUD CONVERT API KEY"
end
If you need a file object for the combined pdf:
CloudConvertMergePdf::Merge.new(files).call
If you need the url for the combined pdf:
CloudConvertMergePdf::Merge.new(files, false).call
files = ['http://www.example.com/1.pdf', 'http://www.example.com/2.pdf']
merge_obj = CloudConvertMergePdf::Merge.new(files)
out_file = @client.call # This will return a Tempfile object for the combined pdf
out_file.unlink # Its a good apporach to unlink the tempfile than leaving it for the garbage collector
Please feel free to contribute to the repository.
The gem is available as open source under the terms of the MIT License.