|
// Initialize API |
|
let annotateApi = groupdocs_annotation_cloud.AnnotateApi.fromKeys(clientId, clientSecret); |
|
|
|
// Define Distance annotation |
|
let a1 = new groupdocs_annotation_cloud.AnnotationInfo(); |
|
a1.annotationPosition = new groupdocs_annotation_cloud.Point(); |
|
a1.annotationPosition.x = 1; |
|
a1.annotationPosition.y = 1; |
|
a1.box = new groupdocs_annotation_cloud.Rectangle(); |
|
a1.box.x = 100 |
|
a1.box.y = 100 |
|
a1.box.width = 200 |
|
a1.box.height = 100 |
|
a1.pageNumber = 0 |
|
a1.penColor = 1201033 |
|
a1.penStyle = groupdocs_annotation_cloud.AnnotationInfo.PenStyleEnum.Solid; |
|
a1.penWidth = 3 |
|
a1.opacity = 1 |
|
a1.type = groupdocs_annotation_cloud.AnnotationInfo.TypeEnum.Distance; |
|
a1.text = "This is distance annotation"; |
|
a1.creatorName = "Anonym A."; |
|
|
|
// Define Area annotation |
|
let a2 = new groupdocs_annotation_cloud.AnnotationInfo(); |
|
a2.annotationPosition = new groupdocs_annotation_cloud.Point(); |
|
a2.annotationPosition.x = 1; |
|
a2.annotationPosition.y = 1; |
|
a2.box = new groupdocs_annotation_cloud.Rectangle(); |
|
a2.box.x = 80 |
|
a2.box.y = 400 |
|
a2.box.width = 200 |
|
a2.box.height = 100 |
|
a2.penColor = 1201033; |
|
a2.penStyle = groupdocs_annotation_cloud.AnnotationInfo.PenStyleEnum.Solid; |
|
a2.pageNumber = 0; |
|
a2.penWidth = 3; |
|
a2.type = groupdocs_annotation_cloud.AnnotationInfo.TypeEnum.Area; |
|
a2.text = "This is area annotation"; |
|
a2.creatorName = "Anonym A."; |
|
|
|
// Define Arrow annotation |
|
let a3 = new groupdocs_annotation_cloud.AnnotationInfo(); |
|
a3.annotationPosition = new groupdocs_annotation_cloud.Point(); |
|
a3.annotationPosition.x = 1; |
|
a3.annotationPosition.y = 1; |
|
a3.box = new groupdocs_annotation_cloud.Rectangle(); |
|
a3.box.x = 100; |
|
a3.box.y = 100; |
|
a3.box.width = 200; |
|
a3.box.height = 100; |
|
a3.pageNumber = 0; |
|
a3.penColor = 1201033; |
|
a3.penStyle = groupdocs_annotation_cloud.AnnotationInfo.PenStyleEnum.Solid; |
|
a3.penWidth = 1; |
|
a3.type = groupdocs_annotation_cloud.AnnotationInfo.TypeEnum.Arrow; |
|
a3.text = "This is arrow annotation"; |
|
a3.creatorName = "Anonym A."; |
|
|
|
// Define Ellipse annotation |
|
let a4 = new groupdocs_annotation_cloud.AnnotationInfo(); |
|
a4.annotationPosition = new groupdocs_annotation_cloud.Point(); |
|
a4.annotationPosition.x = 1; |
|
a4.annotationPosition.y = 1; |
|
a4.box = new groupdocs_annotation_cloud.Rectangle(); |
|
a4.box.x = 350; |
|
a4.box.y = 350; |
|
a4.box.width = 200; |
|
a4.box.height = 100; |
|
a4.pageNumber = 0; |
|
a4.penColor = 1201033; |
|
a4.penStyle = groupdocs_annotation_cloud.AnnotationInfo.PenStyleEnum.Solid; |
|
a4.penWidth = 4; |
|
a4.type = groupdocs_annotation_cloud.AnnotationInfo.TypeEnum.Ellipse; |
|
a4.text = "This is ellipse annotation"; |
|
a4.creatorName = "Anonym A."; |
|
|
|
// Input file path |
|
let fileInfo = new groupdocs_annotation_cloud.FileInfo(); |
|
fileInfo.filePath = "sample.docx"; |
|
|
|
// Define annotate options |
|
let options = new groupdocs_annotation_cloud.AnnotateOptions(); |
|
options.fileInfo = fileInfo; |
|
options.annotations = [a1, a2, a3, a4]; |
|
options.outputPath = "AddMultipleAnnotations.docx"; |
|
|
|
// Create annotate request |
|
let request = new groupdocs_annotation_cloud.AnnotateRequest(options); |
|
|
|
// Annotate |
|
let result = await annotateApi.annotate(request); |