Access the BuildVu Microservice using Javascript

Table of contents

  1. Introduction
  2. Prerequisites
  3. Code Example
  4. Configuration Options
  5. Upload by URL
  6. Using Authentication
  7. Further details


The following tutorial shows you how to convert PDF files to HTML or SVG using a hosted BuildVu cloud API, such as:

Whilst all the above services can be accessed with plain old HTTP requests, this tutorial uses our open source Javascript IDRCloudClient which provides a simple Javascript wrapper around the REST API.


To add the client to your project use will need to add the file idrcloudclient.js to your project and include the following line to access it:

<script src="path/to/idrcloudclient.js" type="text/javascript"></script>

Code Example

Here is a basic code example to convert PDF files to HTML or SVG. Configuration options and advanced features can be found below.

var endpoint = '' + IDRCloudClient.BUILDVU;
var parameters =  {
    //token: 'Token', //Required only when connecting to the IDRsolutions trial or cloud subscription servers
    input: IDRCloudClient.UPLOAD,
    file: 'path/to/exampleFile.pdf'

function progressListener(e) {

function failureListener(e) {

function successListener(e) {
    console.log('Download URL: ' + e.downloadUrl);

    endpoint: endpoint,
    parameters: parameters,
    // The below are the available listeners
    progress: progressListener,
    success: successListener,
    failure: failureListener

An example using the Javascript client can be found here.

Configuration Options

The BuildVu API accepts a stringified JSON object containing key value pair configuration options to customise your conversion. The settings should be added to the parameters array. A full list of the configuration options to convert PDF files to HTML or SVG can be found here.

settings: '{"key":"value","key":"value"}'

Upload by URL

As well as uploading a local file you can also provide a URL which the BuildVu Microservice will download and then perform the conversion. To do this you should replace the input and file values in the parameters variable with the following.

input: IDRCloudClient.DOWNLOAD
url: 'http://exampleURL/exampleFile.pdf'

Using Authentication

If you have deployed your own BuildVu Microservice that requires a username and password to convert PDF files to HTML or SVG, you will need to provide them with each conversion. These are provided by passing two variables named username and password to the convert method as shown below.

username: 'username',
password: 'password',

Further details

IDRCloudClient on GitHub
IDRCloudClient Online Example
BuildVu Microservice API
BuildVu Microservice Use

Still need help? Send us your questions.