Run this command to install the SDK:
npm install cloudmersive-convert-api-client --save
Or add this snippet to your package.json:
"dependencies": { "cloudmersive-convert-api-client": "^2.6.3" }
Run this command to install the SDK:
npm install cloudmersive-convert-api-client --save
Or add this snippet to your package.json:
"dependencies": { "cloudmersive-convert-api-client": "^2.6.3" }
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.EditPdfApi();
var request = new CloudmersiveConvertApiClient.AddPdfAnnotationRequest(); // AddPdfAnnotationRequest |
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.editPdfAddAnnotations(request, callback);
Run this command to install the SDK:
pip install cloudmersive-convert-api-client
from __future__ import print_function
import time
import cloudmersive_convert_api_client
from cloudmersive_convert_api_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: Apikey
configuration = cloudmersive_convert_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
# create an instance of the API class
api_instance = cloudmersive_convert_api_client.EditPdfApi(cloudmersive_convert_api_client.ApiClient(configuration))
request = cloudmersive_convert_api_client.AddPdfAnnotationRequest() # AddPdfAnnotationRequest |
try:
# Add one or more PDF annotations, comments in the PDF document
api_response = api_instance.edit_pdf_add_annotations(request)
pprint(api_response)
except ApiException as e:
print("Exception when calling EditPdfApi->edit_pdf_add_annotations: %s\n" % e)
Run this command to install the SDK:
Install-Package Cloudmersive.APIClient.NET.DocumentAndDataConvert -Version 3.4.2
Run this command to install the SDK:
Install-Package Cloudmersive.APIClient.NETCore.DocumentAndDataConvert -Version 2.2.1
using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Api;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Client;
using Cloudmersive.APIClient.NET.DocumentAndDataConvert.Model;
namespace Example
{
public class EditPdfAddAnnotationsExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new EditPdfApi();
var request = new AddPdfAnnotationRequest(); // AddPdfAnnotationRequest |
try
{
// Add one or more PDF annotations, comments in the PDF document
byte[] result = apiInstance.EditPdfAddAnnotations(request);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling EditPdfApi.EditPdfAddAnnotations: " + e.Message );
}
}
}
}
using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NETCore.DocumentAndDataConvert.Api;
using Cloudmersive.APIClient.NETCore.DocumentAndDataConvert.Client;
using Cloudmersive.APIClient.NETCore.DocumentAndDataConvert.Model;
namespace Example
{
public class EditPdfAddAnnotationsExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new EditPdfApi();
var request = new AddPdfAnnotationRequest(); // AddPdfAnnotationRequest |
try
{
// Add one or more PDF annotations, comments in the PDF document
byte[] result = apiInstance.EditPdfAddAnnotations(request);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling EditPdfApi.EditPdfAddAnnotations: " + e.Message );
}
}
}
}
To install with Maven, add a reference to the repository in pom.xml:
<repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> </repositories>
And add a reference to the dependency in pom.xml:
<dependencies> <dependency> <groupId>com.github.Cloudmersive</groupId> <artifactId>Cloudmersive.APIClient.Java</artifactId> <version>v4.25</version> </dependency> </dependencies>
To install with Gradle, add it in your root build.gradle at the end of repositories:
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }
And add the dependency in build.gradle:
dependencies { implementation 'com.github.Cloudmersive:Cloudmersive.APIClient.Java:v4.25' }
// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.EditPdfApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
EditPdfApi apiInstance = new EditPdfApi();
AddPdfAnnotationRequest request = new AddPdfAnnotationRequest(); // AddPdfAnnotationRequest |
try {
byte[] result = apiInstance.editPdfAddAnnotations(request);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling EditPdfApi#editPdfAddAnnotations");
e.printStackTrace();
}
Run this command to install the SDK:
composer require cloudmersive/cloudmersive_document_convert_api_client
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');
$apiInstance = new Swagger\Client\Api\EditPdfApi(
new GuzzleHttp\Client(),
$config
);
$request = new \Swagger\Client\Model\AddPdfAnnotationRequest(); // \Swagger\Client\Model\AddPdfAnnotationRequest |
try {
$result = $apiInstance->editPdfAddAnnotations($request);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling EditPdfApi->editPdfAddAnnotations: ', $e->getMessage(), PHP_EOL;
}
?>
Add the Objective-C client to your Podfile:
pod 'CloudmersiveDocumentAndDataConvertApiClient', '~> 1.0'
CMDefaultConfiguration *apiConfig = [CMDefaultConfiguration sharedConfig];
// Configure API key authorization: (authentication scheme: Apikey)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"Apikey"];
CMAddPdfAnnotationRequest* request = [[CMAddPdfAnnotationRequest alloc] init]; //
CMEditPdfApi*apiInstance = [[CMEditPdfApi alloc] init];
// Add one or more PDF annotations, comments in the PDF document
[apiInstance editPdfAddAnnotationsWithRequest:request
completionHandler: ^(NSData* output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error calling CMEditPdfApi->editPdfAddAnnotations: %@", error);
}
}];
Add the Ruby client to your Gemfile:
gem 'cloudmersive-convert-api-client', '~> 2.1.6'
# load the gem
require 'cloudmersive-convert-api-client'
# setup authorization
CloudmersiveConvertApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'
end
api_instance = CloudmersiveConvertApiClient::EditPdfApi.new
request = CloudmersiveConvertApiClient::AddPdfAnnotationRequest.new # AddPdfAnnotationRequest |
begin
#Add one or more PDF annotations, comments in the PDF document
result = api_instance.edit_pdf_add_annotations(request)
p result
rescue CloudmersiveConvertApiClient::ApiError => e
puts "Exception when calling EditPdfApi->edit_pdf_add_annotations: #{e}"
end
SwagEditPdfApi api = new SwagEditPdfApi();
SwagClient client = api.getClient();
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) client.getAuthentication('Apikey');
Apikey.setApiKey('YOUR API KEY');
Map<String, Object> params = new Map<String, Object>{
'request' => SwagAddPdfAnnotationRequest.getExample()
};
try {
// cross your fingers
Blob result = api.editPdfAddAnnotations(params);
System.debug(result);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Install libcurl in your C/C++ project:
libcurl/7.75.0
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://api.cloudmersive.com/convert/edit/pdf/annotations/add-item");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
headers = curl_slist_append(headers, "Apikey: YOUR-API-KEY-HERE");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
const char *data = "InputFileBytes=%3Cbyte%3E&AnnotationsToAdd=%7B%22Title%22%3A%22ipsum%20cillum%20ame%22%2C%22AnnotationType%22%3A%22laboris%20nostrud%20aliquip%20ullamco%22%2C%22PageNumber%22%3A24536442%2C%22AnnotationIndex%22%3A-92410312%2C%22Subject%22%3A%22ullamco%20pariatur%20nostrud%20%22%2C%22TextContents%22%3A%22laboris%20nisi%20minim%20incididunt%22%2C%22CreationDate%22%3A%221954-04-21T14%3A53%3A15.083Z%22%2C%22ModifiedDate%22%3A%221987-12-07T18%3A44%3A17.856Z%22%2C%22LeftX%22%3A-85159016.27516098%2C%22TopY%22%3A55771511.400776625%2C%22Width%22%3A86862007.8659774%2C%22Height%22%3A2101287.3569994867%7D&AnnotationsToAdd=%7B%22Title%22%3A%22in%20veniam%20est%20ut%20mollit%22%2C%22AnnotationType%22%3A%22ut%20dolor%20id%20sit%22%2C%22PageNumber%22%3A60939588%2C%22AnnotationIndex%22%3A-90587706%2C%22Subject%22%3A%22minim%20eiusmod%20in%22%2C%22TextContents%22%3A%22cupidatat%20laboris%20sint%22%2C%22CreationDate%22%3A%221982-02-06T21%3A28%3A03.707Z%22%2C%22ModifiedDate%22%3A%221985-12-20T00%3A44%3A50.494Z%22%2C%22LeftX%22%3A36433194.888030946%2C%22TopY%22%3A23546503.390691683%2C%22Width%22%3A50338981.8010267%2C%22Height%22%3A-3662431.142999798%7D";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
res = curl_easy_perform(curl);
}
curl_easy_cleanup(curl);
curl --location --request POST 'https://api.cloudmersive.com/convert/edit/pdf/annotations/add-item' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Apikey: YOUR-API-KEY-HERE' \
--data-urlencode 'InputFileBytes=<byte>' \
--data-urlencode 'AnnotationsToAdd={"Title":"laborum ut id","AnnotationType":"in laboris sit dolore minim","PageNumber":-15928272,"AnnotationIndex":49895090,"Subject":"ex commodo dolor officia qui","TextContents":"deserunt et eiusmod","CreationDate":"2021-07-01T03:18:28.893Z","ModifiedDate":"1967-10-08T08:10:33.414Z","LeftX":43075121.39637107,"TopY":-67718117.29580733,"Width":42540358.62770724,"Height":-16278464.44215338}' \
--data-urlencode 'AnnotationsToAdd={"Title":"fugiat Duis in sit","AnnotationType":"Duis cillum","PageNumber":51549286,"AnnotationIndex":19430034,"Subject":"sed cillum","TextContents":"nulla sed cupidatat","CreationDate":"1993-06-01T05:17:13.137Z","ModifiedDate":"2004-06-29T22:33:45.026Z","LeftX":-33366343.347999863,"TopY":-36914041.25916029,"Width":6414259.156089038,"Height":-60389179.030276276}'
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = "InputFileBytes=%3Cbyte%3E&AnnotationsToAdd=%7B%22Title%22%3A%22occae%22%2C%22AnnotationType%22%3A%22nulla%20ex%22%2C%22PageNumber%22%3A80153157%2C%22AnnotationIndex%22%3A-15715651%2C%22Subject%22%3A%22tempor%20adipisicing%20in%22%2C%22TextContents%22%3A%22est%20et%22%2C%22CreationDate%22%3A%221953-07-18T09%3A56%3A34.781Z%22%2C%22ModifiedDate%22%3A%221975-10-10T07%3A15%3A23.108Z%22%2C%22LeftX%22%3A-29501919.29889466%2C%22TopY%22%3A-73430405.79858053%2C%22Width%22%3A39491575.2799598%2C%22Height%22%3A56545742.53642461%7D&AnnotationsToAdd=%7B%22Title%22%3A%22magna%20aute%22%2C%22AnnotationType%22%3A%22quis%20Duis%22%2C%22PageNumber%22%3A12033878%2C%22AnnotationIndex%22%3A33595203%2C%22Subject%22%3A%22in%20adipisicing%22%2C%22TextContents%22%3A%22voluptate%20consectetur%20et%20officia%22%2C%22CreationDate%22%3A%221972-09-01T07%3A16%3A25.186Z%22%2C%22ModifiedDate%22%3A%221952-06-03T10%3A46%3A28.254Z%22%2C%22LeftX%22%3A-14757425.246229649%2C%22TopY%22%3A71558891.33398384%2C%22Width%22%3A1672822.120931983%2C%22Height%22%3A36524842.09113482%7D"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.cloudmersive.com/convert/edit/pdf/annotations/add-item")!,timeoutInterval: Double.infinity)
request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
request.addValue("YOUR-API-KEY-HERE", forHTTPHeaderField: "Apikey")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
This code snippet uses the built-in JavaScript XHR request capability
Run this command to install jQuery:
bower install jquery
var data = "InputFileBytes=%3Cbyte%3E&AnnotationsToAdd=%7B%22Title%22%3A%22ut%20laboris%20adipisicing%20ex%22%2C%22AnnotationType%22%3A%22commodo%20ipsum%20velit%20mollit%22%2C%22PageNumber%22%3A95256386%2C%22AnnotationIndex%22%3A-17565291%2C%22Subject%22%3A%22dolore%22%2C%22TextContents%22%3A%22anim%20minim%20quis%20laboris%20Ut%22%2C%22CreationDate%22%3A%221979-10-02T08%3A04%3A50.654Z%22%2C%22ModifiedDate%22%3A%221970-04-16T15%3A00%3A02.307Z%22%2C%22LeftX%22%3A-35872649.63197039%2C%22TopY%22%3A-89707352.74418975%2C%22Width%22%3A-35762632.54393335%2C%22Height%22%3A-37085215.34102775%7D&AnnotationsToAdd=%7B%22Title%22%3A%22labore%20non%20enim%20in%22%2C%22AnnotationType%22%3A%22non%20anim%20ad%22%2C%22PageNumber%22%3A22152743%2C%22AnnotationIndex%22%3A-46344461%2C%22Subject%22%3A%22in%20in%20id%22%2C%22TextContents%22%3A%22ut%20reprehenderit%22%2C%22CreationDate%22%3A%222001-11-19T18%3A30%3A23.200Z%22%2C%22ModifiedDate%22%3A%222009-02-01T18%3A54%3A09.807Z%22%2C%22LeftX%22%3A-98936317.04426573%2C%22TopY%22%3A50951571.21639934%2C%22Width%22%3A-48618501.98239099%2C%22Height%22%3A20593718.779674843%7D";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api.cloudmersive.com/convert/edit/pdf/annotations/add-item");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("Apikey", "YOUR-API-KEY-HERE");
xhr.send(data);
var settings = {
"url": "https://api.cloudmersive.com/convert/edit/pdf/annotations/add-item",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Apikey": "YOUR-API-KEY-HERE"
},
"data": {
"InputFileBytes": "<byte>",
"AnnotationsToAdd": "{\"Title\":\"ut mollit qui Lorem\",\"AnnotationType\":\"esse\",\"PageNumber\":-73756400,\"AnnotationIndex\":97198131,\"Subject\":\"qui veniam\",\"TextContents\":\"velit Lore\",\"CreationDate\":\"1971-02-18T05:37:25.201Z\",\"ModifiedDate\":\"2012-07-27T08:26:16.092Z\",\"LeftX\":2744179.0878992975,\"TopY\":-37030669.70052684,\"Width\":91069047.01981282,\"Height\":-74127941.63680845}",
"AnnotationsToAdd": "{\"Title\":\"elit officia ut dolore\",\"AnnotationType\":\"adipisicing enim\",\"PageNumber\":-62517085,\"AnnotationIndex\":20558779,\"Subject\":\"incididunt consequat ipsum\",\"TextContents\":\"dolore voluptate\",\"CreationDate\":\"2005-10-21T23:00:45.490Z\",\"ModifiedDate\":\"2013-07-08T17:18:50.230Z\",\"LeftX\":30838977.42571619,\"TopY\":-7397850.887928262,\"Width\":-94584372.8514899,\"Height\":-16898638.701297402}"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.cloudmersive.com/convert/edit/pdf/annotations/add-item"
method := "POST"
payload := strings.NewReader("InputFileBytes=%3Cbyte%3E&AnnotationsToAdd=%7B%22Title%22%3A%22dolore%20cupidatat%20of%22%2C%22AnnotationType%22%3A%22sunt%20ut%20eu%20nulla%22%2C%22PageNumber%22%3A-80583433%2C%22AnnotationIndex%22%3A348241%2C%22Subject%22%3A%22aliquip%20dolore%20tempor%20aliqua%22%2C%22TextContents%22%3A%22qui%20quis%20%22%2C%22CreationDate%22%3A%221993-05-16T12%3A56%3A22.101Z%22%2C%22ModifiedDate%22%3A%221964-12-10T13%3A35%3A07.676Z%22%2C%22LeftX%22%3A13224887.175327376%2C%22TopY%22%3A-98216007.80063808%2C%22Width%22%3A-33012993.7489573%2C%22Height%22%3A79028522.53547564%7D&AnnotationsToAdd=%7B%22Title%22%3A%22amet%20occaecat%20id%20magna%20ex%22%2C%22AnnotationType%22%3A%22laboris%20dolor%20cupidatat%20exercitation%20amet%22%2C%22PageNumber%22%3A14135291%2C%22AnnotationIndex%22%3A-93053536%2C%22Subject%22%3A%22consectetur%20incididunt%20do%22%2C%22TextContents%22%3A%22pariatur%20in%20anim%20non%22%2C%22CreationDate%22%3A%222012-11-25T22%3A26%3A29.461Z%22%2C%22ModifiedDate%22%3A%221991-11-20T09%3A34%3A48.406Z%22%2C%22LeftX%22%3A32932062.497325674%2C%22TopY%22%3A-8677082.160251632%2C%22Width%22%3A12875198.370867163%2C%22Height%22%3A96162265.03087369%7D")
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
req.Header.Add("Apikey", "YOUR-API-KEY-HERE")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}