Begin Editing a Document in JavaScript
Editing an online document isn’t always the easiest or most enjoyable task. To avoid any manual messes, we will be demonstrating how you can use an API in JavaScript to upload a document and begin a series of one or more editing operations by calling a begin editing function. After the function is called, you will be able to perform actions such as inserting tables, deleting pages, and more.
Our first step is to run this command to install jQuery:
bower install jquery
Once the installation is complete, we can configure the API key and call the function with the following code:
var form = new FormData();
form.append("inputFile", fileInput.files[0], "file");var settings = {
"url": "https://api.cloudmersive.com/convert/edit/begin-editing",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "multipart/form-data",
"Apikey": "YOUR-API-KEY-HERE"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};$.ajax(settings).done(function (response) {
console.log(response);
});
This will provide you with a temporary and secure editing URL that you can use to perform further editing operations. If you to obtain an API key, you can do so by registering for a free account on the Cloudmersive website; this provides 800 calls/month across our entire library of APIs.