How to Convert ODP to JPG in Node.JS

ODP is a good format for the production phase, but can often get in the way when it comes time to share work with the public. Today we are going to be laying out a means of converting your Open Document Presentation files into nice convenient JPEGs. With a Cloudmersive API getting our back, we will be able to get this done in double-quick time. Let’s begin.

Starting things off, we must install our client. This can be done by simply adding the following dependency to your project’s package.json file.

"dependencies": {
"cloudmersive-convert-api-client": "^2.4.8"

And now we will be able to use that client to create an API instance, from which we can call convertDocumentOdpToJpg. This is all demonstrated in the following example snippet.

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveConvertApiClient.ConvertDocumentApi();var inputFile = "/path/to/file"; // File | Input file to perform the operation on.var opts = {'quality': 56 // Number | Optional; Set the JPEG quality level; lowest quality is 1 (highest compression), highest quality (lowest compression) is 100; recommended value is 75. Default value is 75.};var callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.convertDocumentOdpToJpg(inputFile, opts, callback);

Done! We also offer a ton of other conversion functions like this, with support for more Open Document formats and many others.

Image for post
Image for post

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store