How to Begin Editing a Document in Node.JS
Learning how to edit a document online may seem daunting, but with the right tools, it becomes a simple task. The following API will allow you to upload a document to begin a series of one or more editing operations using a call to begin editing. This will return a secure URL with which you can perform further editing actions such as inserting tables, deleting pages, or replacing text strings. Any kind of document can be edited using this action including Word documents, and because the URL is temporary, you do not have to worry about sensitive information being stored in any undesirable locations.
You can use this function by running the following command to install the SDK:
npm install cloudmersive-convert-api-client --save
Or, you can add this snippet to your package.json:
"dependencies": {
"cloudmersive-convert-api-client": "^2.4.8"
}
Then, we can call the function:
var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');
var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';var apiInstance = new CloudmersiveConvertApiClient.EditDocumentApi();var inputFile = Buffer.from(fs.readFileSync("C:\\temp\\inputfile").buffer); // File | Input file to perform the operation on.var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.editDocumentBeginEditing(inputFile, callback);
You can retrieve the API Key for this function at no cost and with no commitment on the Cloudmersive website. This will give you access to 800 monthly calls across our entire API library.