- Code Example
- Return result to a callback url
- Configuration Options
- Upload by URL
- Using Authentication
- Further details
The following tutorial shows you how to convert PDF forms to HTML using a hosted FormVu cloud API, such as:
- the IDRsolutions trial and cloud subscription service
- your own self-hosted FormVu microservice
There are two approaches to using the IDRCloudClient in your project.
Using gem, install the idr_cloud_client gem with the following command:
gem install idr_cloud_client
Alternatively, you can add the line “gem ‘idr_cloud_client’” to your applications gemfile then run the following command.
Here is a basic code example to convert PDF forms to HTML. Configuration options and advanced features can be found below.
require 'idr_cloud_client' client = IDRCloudClient.new('https://cloud.idrsolutions.com/cloud/' + IDRCloudClient::FORMVU) result = client.convert( # token='Token', # Required only when connecting to the IDRsolutions trial and cloud subscription service input: IDRCloudClient::UPLOAD, file: 'path/to/exampleFile.pdf') client.download_result(result, 'path/to/output/dir') puts 'Download URL: ' + result['downloadUrl']
The FormVu Microservice accepts a callback url to send the status of a conversion on completion. Using a callback url removes the need to poll the service to determine when the conversion is complete.
The callback url can be provided to the convert method as shown below.
result = client.convert( # token='Token', # Required only when connecting to the IDRsolutions trial and cloud subscription service input: IDRCloudClient::UPLOAD, file: 'path/to/exampleFile.pdf', callbackUrl: 'http://listener.url')
The FormVu API accepts a stringified JSON object containing key value pair configuration options to customise your conversion. The settings should be provided to the convert method. A full list of the configuration options to convert PDF forms to HTML can be found here.
As well as uploading a local file you can also provide a URL which the FormVu Microservice will download and then perform the conversion. To do this you should replace the input and file values in the convert method with the following.
If you have deployed your own FormVu Microservice that requires a username and password to convert PDF forms to HTML, you will need to provide them with each conversion. These are provided by passing a variable named auth to the convert method as shown below.