Last active
February 23, 2021 10:49
-
-
Save groupdocscloud/adf9db2b064fbf397457fa83429d9efa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Annotation-Python-v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a = AnnotationInfo() | |
a.annotation_position = Point() | |
a.annotation_position.x = 852 | |
a.annotation_position.y = 59.388262910798119 | |
a.box = Rectangle() | |
a.box.x = 375.89276123046875 | |
a.box.y = 59.388263702392578 | |
a.box.width = 88.7330551147461 | |
a.box.height = 37.7290153503418 | |
a.page_number = 0 | |
a.pen_color = 1201033 | |
a.pen_style = 0 | |
a.pen_width = 1 | |
a.type = "Area" | |
a.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\one-page.docx", [a]) | |
api.post_annotations(request) | |
print("Expected response type is void: Annotation added.") | |
except ApiException as e: | |
print("Exception when calling Annotation_Python_Add_Annotation: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_Area_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.pen_color = 1201033 | |
a1.pen_style = 0 | |
a1.pen_width = 1 | |
a1.opacity = 0.7 | |
a1.type = "Area" | |
a1.text = "This is area annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Area Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_Arrow_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.pen_color = 1201033 | |
a1.pen_style = 0 | |
a1.pen_width = 1 | |
a1.opacity = 0.7 | |
a1.type = "Arrow" | |
a1.text = "This is arrow annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Arrow Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client_id = "112f0f38-9dae-42d5-b4fc-cc84ae644972" | |
client_secret = "16ad3fe0bdc39c910f57d2fd48a5d618" | |
my_storage = "" | |
configurations = groupdocs_annotation_cloud.Configuration(client_id, client_secret) | |
configurations.api_base_url = "https://api.groupdocs.cloud" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a1.type = "Image" | |
a1.text = "This is Image annotation" | |
a1.image_path = "sample.png" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_Multiple_Annotations: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 0 | |
a1.pen_color = 1201033 | |
a1.pen_style = 0 | |
a1.pen_width = 1 | |
a1.opacity = 0.7 | |
a1.type = "Distance" | |
a1.text = "This is distance annotation" | |
a1.creator_name = "Anonym A." | |
a2 = groupdocs_annotation_cloud.AnnotationInfo() | |
a2.annotation_position = groupdocs_annotation_cloud.Point() | |
a2.annotation_position.x = 852 | |
a2.annotation_position.y = 59.388262910798119 | |
a2.box = groupdocs_annotation_cloud.Rectangle() | |
a2.box.x = 375.89276123046875 | |
a2.box.y = 59.388263702392578 | |
a2.box.width = 88.7330551147461 | |
a2.box.height = 37.7290153503418 | |
a2.page_number = 2 | |
a2.pen_color = 1201033 | |
a2.pen_style = 0 | |
a2.pen_width = 1 | |
a2.opacity = 0.7 | |
a2.type = "Area" | |
a2.text = "This is area annotation" | |
a2.creator_name = "Anonym A." | |
a3 = groupdocs_annotation_cloud.AnnotationInfo() | |
a3.annotation_position = groupdocs_annotation_cloud.Point() | |
a3.annotation_position.x = 852 | |
a3.annotation_position.y = 59.388262910798119 | |
a3.box = groupdocs_annotation_cloud.Rectangle() | |
a3.box.x = 375.89276123046875 | |
a3.box.y = 59.388263702392578 | |
a3.box.width = 88.7330551147461 | |
a3.box.height = 37.7290153503418 | |
a3.page_number = 4 | |
a3.opacity = 0.7 | |
a3.type = "Point" | |
a3.text = "This is point annotation" | |
a3.creator_name = "Anonym A." | |
a4 = groupdocs_annotation_cloud.AnnotationInfo() | |
a4.annotation_position = groupdocs_annotation_cloud.Point() | |
a4.annotation_position.x = 852 | |
a4.annotation_position.y = 59.388262910798119 | |
a4.box = groupdocs_annotation_cloud.Rectangle() | |
a4.box.x = 375.89276123046875 | |
a4.box.y = 59.388263702392578 | |
a4.box.width = 88.7330551147461 | |
a4.box.height = 37.7290153503418 | |
a4.page_number = 5 | |
a4.pen_color = 1201033 | |
a4.pen_style = 0 | |
a4.pen_width = 1 | |
a4.opacity = 0.7 | |
a4.type = "Arrow" | |
a4.text = "This is arrow annotation" | |
a4.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1, a2, a3, a4]) | |
api.post_annotations(request) | |
print("Expected response type is void: Multiple Annotations added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_Point_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.pen_color = 1201033 | |
a1.pen_style = 0 | |
a1.pen_width = 1 | |
a1.opacity = 0.7 | |
a1.type = "Point" | |
a1.text = "This is point annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Point Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_Polyline_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.pen_color = 1201033 | |
a1.pen_style = 0 | |
a1.pen_width = 1 | |
a1.opacity = 0.7 | |
a1.type = "Polyline" | |
a1.text = "This is polyline annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Polyline Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_Text_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.font_color = 1201033 | |
a1.font_size = 12 | |
a1.opacity = 0.7 | |
a1.type = "Text" | |
a1.text = "This is text annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Text Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_TextField_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.font_color = 1201033 | |
a1.font_size = 12 | |
a1.opacity = 0.7 | |
a1.type = "TextField" | |
a1.text = "This is text field annotation" | |
a1.field_text = "Text field text" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Text Field Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_TextRedaction_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.font_color = 1201033 | |
a1.font_size = 12 | |
a1.opacity = 0.7 | |
a1.type = "TextRedaction" | |
a1.text = "This is text redaction annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Text Redaction Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_TextReplacement_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.font_color = 1201033 | |
a1.font_size = 12 | |
a1.opacity = 0.7 | |
a1.type = "TextReplacement" | |
a1.text = "This is text replacement annotation" | |
a1.field_text = "Text to replace" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Text Replacement Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_TextStrikeout_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.page_number = 2 | |
a1.font_color = 1201033 | |
a1.opacity = 0.7 | |
a1.type = "TextStrikeout" | |
a1.text = "This is text strikeout annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Text Strikeout Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_TextUnderline_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.page_number = 2 | |
a1.font_color = 1201033 | |
a1.opacity = 0.7 | |
a1.type = "TextUnderline" | |
a1.text = "This is text underline annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Text Underline Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Add_Watermark_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 852 | |
a1.annotation_position.y = 59.388262910798119 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 375.89276123046875 | |
a1.box.y = 59.388263702392578 | |
a1.box.width = 88.7330551147461 | |
a1.box.height = 37.7290153503418 | |
a1.page_number = 2 | |
a1.font_color = 1201033 | |
a1.font_size = 12 | |
a1.opacity = 0.7 | |
a1.angle = 75 | |
a1.type = "Watermark" | |
a1.text = "This is text watermark annotation" | |
a1.creator_name = "Anonym A." | |
request = PostAnnotationsRequest("annotationdocs\\ten-pages.docx", [a1]) | |
api.post_annotations(request) | |
print("Expected response type is void: Text Watermark Annotation added.") | |
except ApiException as e: | |
print("Exception when calling AnnotateAPI: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api = groupdocs_annotation_cloud.AnnotateApi.from_keys(client_id, client_secret) | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 1 | |
a1.annotation_position.y = 1 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 100 | |
a1.box.y = 100 | |
a1.box.width = 200 | |
a1.box.height = 100 | |
a1.page_number = 0 | |
a1.pen_color = 1201033 | |
a1.pen_style = "Solid" | |
a1.pen_width = 1 | |
a1.opacity = 0.7 | |
# Add Area Annotation | |
a1.type = "Area" | |
a1.text = "This is area annotation" | |
a1.creator_name = "Anonym A." | |
file_info = groupdocs_annotation_cloud.FileInfo() | |
file_info.file_path = "one-page.docx" | |
options = groupdocs_annotation_cloud.AnnotateOptions() | |
options.file_info = file_info | |
options.annotations = [a1] | |
options.output_path = "Output\\output.docx" | |
request = groupdocs_annotation_cloud.AnnotateRequest(options) | |
result = api.annotate(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Copy_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.CopyFileRequest("annotationdocs\\one-page.docx", "annotationdocs\\one-page-copied.docx", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.copy_file(request) | |
print("Expected response type is Void: 'annotationdocs/one-page.docx' file copied as 'annotationdocs/one-page-copied.docx'.") | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Copy_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.CopyFolderRequest("annotationdocs", "annotationdocs1", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.copy_folder(request) | |
print("Expected response type is Void: 'annotationdocs' folder copied as 'annotationdocs1'.") | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Create_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.CreateFolderRequest("Assembler", Common_Utilities.myStorage) | |
api.create_folder(request) | |
print("Expected response type is Void: 'Assembler' folder created.") | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import os | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Delete_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
request = DeleteAnnotationsRequest("annotationdocs\\one-page.docx") | |
api.delete_annotations(request) | |
print("Expected response type is Void: Annotation deleted from document.") | |
except ApiException as e: | |
print("Exception when calling Annotation_Python_Delete_Annotation: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Delete_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.DeleteFileRequest("annotationdocs1\\one-page.docx", Common_Utilities.myStorage) | |
api.delete_file(request) | |
print("Expected response type is Void: 'annotationdocs1/one-page.docx' deleted.") | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Delete_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.DeleteFolderRequest("annotationdocs\\annotationdocs1", Common_Utilities.myStorage, True) | |
api.delete_folder(request) | |
print("Expected response type is Void: 'annotationdocs/annotationdocs1' folder deleted recursively.") | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Delete_Pages: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_PreviewApi_Instance() | |
try: | |
request = DeletePagesRequest("annotationdocs\\one-page.docx") | |
api.delete_pages(request) | |
print("Pages removed for file: 'annotationdocs\one-page.docx'") | |
except ApiException as e: | |
print("Exception when calling Annotation_Python_Delete_Pages: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_DocumentInfo_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
request = GetInfoRequest("annotationdocs\\one-page.docx", None) | |
response = api.get_info(request) | |
print("file_path: " + str(response)) | |
except ApiException as e: | |
print("Exception when calling Annotation_Python_DocumentInfo_File: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create instance of the API | |
file_api = groupdocs_annotation_cloud.FileApi.from_config(configurations) | |
request = groupdocs_annotation_cloud.DownloadFileRequest("Output\\output.docx", my_storage) | |
response = file_api.download_file(request) | |
# Move downloaded file to your working directory | |
shutil.move(response, "C:\\Files\\") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Download_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.DownloadFileRequest("annotationdocs\\one-page.docx", Common_Utilities.myStorage) | |
response = api.download_file(request) | |
print("Expected response type is Stream: " + str(len(response))) | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities; | |
class Annotation_Python_Get_All_Supported_Formats: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_InfoApi_Instance() | |
try: | |
# Retrieve supported file-formats | |
response = api.get_supported_file_formats() | |
# Print out supported file-formats | |
print("Supported file-formats:") | |
for fileformat in response.formats: | |
print('{0} ({1})'.format(fileformat.file_format, fileformat.extension)) | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception when calling get_supported_annotation_types: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Get_Annotation: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
request = GetImportRequest("annotationdocs\\one-page.docx") | |
response = api.get_import(request) | |
print("Expected response type is List<AnnotationInfo>: Count: " + str(len(response))) | |
except ApiException as e: | |
print("Exception when calling Annotation_Python_Get_Annotation: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Get_Disc_Usage: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.GetDiscUsageRequest(Common_Utilities.myStorage) | |
response = api.get_disc_usage(request) | |
print("Expected response type is DiscUsage: " + str(response)) | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import os | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Get_Export_Document: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
request = GetExportRequest("annotationdocs\\one-page.docx", "Area,", None, None, None, None) | |
response = api.get_export(request) | |
print("Expected response type is Stream: Document Length: " + str(os.path.getsize(response))) | |
except ApiException as e: | |
print("Exception when calling Annotation_Python_Get_Export_Document: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Get_File_Versions: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.GetFileVersionsRequest("annotationdocs\\one-page.docx", Common_Utilities.myStorage) | |
response = api.get_file_versions(request) | |
print("Expected response type is FileVersions: " + str(response)) | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Get_Files_List: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.GetFilesListRequest("annotationdocs\\sample.docx", Common_Utilities.myStorage) | |
response = api.get_files_list(request) | |
print("Expected response type is FilesList: " + str(response)) | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Get_Pages: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_PreviewApi_Instance() | |
try: | |
request = GetPagesRequest("annotationdocs\\one-page.docx", None, None, None, None, None, None, None) | |
response = api.get_pages(request) | |
print("Page Count: " + str(response.total_count)) | |
except ApiException as e: | |
print("Exception when calling Annotation_Python_Get_Pages: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import os | |
from groupdocs_annotation_cloud import * | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Get_PDF: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_AnnotateApi_Instance() | |
try: | |
request = GetPdfRequest("annotationdocs\\one-page.docx") | |
response = api.get_pdf(request) | |
print("Expected response type is Stream: Document Length: " + str(os.path.getsize(response))) | |
except ApiException as e: | |
print("Exception when calling Annotation_Python_Get_PDF: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Move_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.MoveFileRequest("annotationdocs\\one-page.docx", "annotationdocs1\\one-page.docx", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.move_file(request) | |
print("Expected response type is Void: 'annotationdocs/one-page.docx' file moved to 'annotationdocs1/one-page.docx'.") | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Move_Folder: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FolderApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.MoveFolderRequest("annotationdocs1", "annotationdocs1\\annotationdocs", Common_Utilities.myStorage, Common_Utilities.myStorage) | |
api.move_folder(request) | |
print("Expected response type is Void: 'annotationdocs1' folder moved to 'annotationdocs/annotationdocs1'.") | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
api = groupdocs_annotation_cloud.AnnotateApi.from_keys(client_id, client_secret) | |
a1 = groupdocs_annotation_cloud.AnnotationInfo() | |
a1.annotation_position = groupdocs_annotation_cloud.Point() | |
a1.annotation_position.x = 1 | |
a1.annotation_position.y = 1 | |
a1.box = groupdocs_annotation_cloud.Rectangle() | |
a1.box.x = 200 | |
a1.box.y = 200 | |
a1.box.width = 300 | |
a1.box.height = 100 | |
a1.page_number = 0 | |
a1.pen_color = 1201033 | |
a1.pen_style = "Solid" | |
a1.pen_width = 1 | |
a1.opacity = 0.2 | |
a1.type = "Watermark" | |
a1.text = "This is watermark annotation" | |
a1.creator_name = "Anonym A." | |
a2 = groupdocs_annotation_cloud.AnnotationInfo() | |
a2.annotation_position = groupdocs_annotation_cloud.Point() | |
a2.annotation_position.x = 852 | |
a2.annotation_position.y = 59.38 | |
a2.box = groupdocs_annotation_cloud.Rectangle() | |
a2.box.x = 375.8 | |
a2.box.y = 59.38 | |
a2.box.width = 88 | |
a2.box.height = 37 | |
a2.page_number = 2 | |
a2.pen_color = 1201033 | |
a2.pen_style = "Solid" | |
a2.pen_width = 1 | |
a2.opacity = 0.9 | |
a2.type = "Image" | |
a2.text = "This is Image annotation" | |
a2.creator_name = "Anonym A." | |
a2.image_path = "JohnSmith.png" | |
file_info = groupdocs_annotation_cloud.FileInfo() | |
file_info.file_path = "ten-pages.docx" | |
options = groupdocs_annotation_cloud.AnnotateOptions() | |
options.file_info = file_info | |
options.annotations = [a1, a2] | |
options.output_path = "Output\\output.docx" | |
request = groupdocs_annotation_cloud.AnnotateRequest(options) | |
result = api.annotate(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Object_Exists: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.ObjectExistsRequest("annotationdocs\\one-page.docx", Common_Utilities.myStorage) | |
response = api.object_exists(request) | |
print("Expected response type is ObjectExist: " + str(response)) | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
from Supported_File_Formats.Annotation_Python_Get_All_Supported_Formats import Annotation_Python_Get_All_Supported_Formats | |
# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required). | |
Common_Utilities.host_url = "https://api.groupdocs.cloud" # Put your Host URL here | |
Common_Utilities.app_sid = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" | |
Common_Utilities.app_key = "XXXXXXXXXXXXXXX" | |
Common_Utilities.myStorage = "XXXXX" | |
# ######################################### | |
# print("Executing Upload Test Files...") | |
# Common_Utilities.Upload_Test_Files() | |
# ######################################### | |
########################################### | |
#******* Execute Examples ******* | |
print("*** Executing examples...") | |
#******* Execute Examples ******* | |
########################################### | |
######################################### | |
print("*** Executing Get_Supported_Formats...") | |
######################################### | |
print("* Executing Annotation_Python_Get_All_Supported_Formats...") | |
Annotation_Python_Get_All_Supported_Formats.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Storage...") | |
# ########################################## | |
# print("* Executing Annotation_Python_Storage_Exist...") | |
# from Working_With_Storage.Annotation_Python_Storage_Exist import Annotation_Python_Storage_Exist | |
# Annotation_Python_Storage_Exist.Run() | |
# print("* Executing Annotation_Python_Object_Exists...") | |
# from Working_With_Storage.Annotation_Python_Object_Exists import Annotation_Python_Object_Exists | |
# Annotation_Python_Object_Exists.Run() | |
# print("* Executing Annotation_Python_Get_File_Versions...") | |
# from Working_With_Storage.Annotation_Python_Get_File_Versions import Annotation_Python_Get_File_Versions | |
# Annotation_Python_Get_File_Versions.Run() | |
# print("* Executing Annotation_Python_Get_Disc_Usage...") | |
# from Working_With_Storage.Annotation_Python_Get_Disc_Usage import Annotation_Python_Get_Disc_Usage | |
# Annotation_Python_Get_Disc_Usage.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Folder...") | |
# ########################################## | |
# print("* Executing Annotation_Python_Create_Folder...") | |
# from Working_With_Folder.Annotation_Python_Create_Folder import Annotation_Python_Create_Folder | |
# Annotation_Python_Create_Folder.Run() | |
# print("* Executing Annotation_Python_Copy_Folder...") | |
# from Working_With_Folder.Annotation_Python_Copy_Folder import Annotation_Python_Copy_Folder | |
# Annotation_Python_Copy_Folder.Run() | |
# print("* Executing Annotation_Python_Get_Files_List...") | |
# from Working_With_Folder.Annotation_Python_Get_Files_List import Annotation_Python_Get_Files_List | |
# Annotation_Python_Get_Files_List.Run() | |
# print("* Executing Annotation_Python_Move_Folder...") | |
# from Working_With_Folder.Annotation_Python_Move_Folder import Annotation_Python_Move_Folder | |
# Annotation_Python_Move_Folder.Run() | |
# print("* Executing Annotation_Python_Delete_Folder...") | |
# from Working_With_Folder.Annotation_Python_Delete_Folder import Annotation_Python_Delete_Folder | |
# Annotation_Python_Delete_Folder.Run() | |
# ########################################## | |
# print("*** Executing Working_With_Files...") | |
# ########################################## | |
# print("* Executing Annotation_Python_Upload_File...") | |
# from Working_With_Files.Annotation_Python_Upload_File import Annotation_Python_Upload_File | |
# Annotation_Python_Upload_File.Run() | |
# print("* Executing Annotation_Python_Download_File...") | |
# from Working_With_Files.Annotation_Python_Download_File import Annotation_Python_Download_File | |
# Annotation_Python_Download_File.Run() | |
# print("* Executing Annotation_Python_Copy_File...") | |
# from Working_With_Files.Annotation_Python_Copy_File import Annotation_Python_Copy_File | |
# Annotation_Python_Copy_File.Run() | |
# print("* Executing Annotation_Python_Move_File...") | |
# from Working_With_Files.Annotation_Python_Move_File import Annotation_Python_Move_File | |
# Annotation_Python_Move_File.Run() | |
# print("* Executing Annotation_Python_Delete_File...") | |
# from Working_With_Files.Annotation_Python_Delete_File import Annotation_Python_Delete_File | |
# Annotation_Python_Delete_File.Run() | |
# ############################################################ | |
# print("*** Executing Working_With_Document_Information...") | |
# ############################################################ | |
# print("* Executing Annotation_Python_DocumentInfo_File...") | |
# from Document_Information.Annotation_Python_DocumentInfo_File import Annotation_Python_DocumentInfo_File | |
# Annotation_Python_DocumentInfo_File.Run() | |
# ############################################################ | |
# print("*** Executing Working_With_Annotations...") | |
# ############################################################ | |
# print("* Executing Annotation_Python_Add_Multiple_Annotations...") | |
# from Working_With_Annotations.Annotation_Python_Add_Multiple_Annotations import Annotation_Python_Add_Multiple_Annotations | |
# Annotation_Python_Add_Multiple_Annotations.Run() | |
# print("* Executing Annotation_Python_Add_Area_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_Area_Annotation import Annotation_Python_Add_Area_Annotation | |
# Annotation_Python_Add_Area_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_Arrow_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_Arrow_Annotation import Annotation_Python_Add_Arrow_Annotation | |
# Annotation_Python_Add_Arrow_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_Point_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_Point_Annotation import Annotation_Python_Add_Point_Annotation | |
# Annotation_Python_Add_Point_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_Polyline_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_Polyline_Annotation import Annotation_Python_Add_Polyline_Annotation | |
# Annotation_Python_Add_Polyline_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_Text_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_Text_Annotation import Annotation_Python_Add_Text_Annotation | |
# Annotation_Python_Add_Text_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_TextField_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_TextField_Annotation import Annotation_Python_Add_TextField_Annotation | |
# Annotation_Python_Add_TextField_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_TextRedaction_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_TextRedaction_Annotation import Annotation_Python_Add_TextRedaction_Annotation | |
# Annotation_Python_Add_TextRedaction_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_TextReplacement_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_TextReplacement_Annotation import Annotation_Python_Add_TextReplacement_Annotation | |
# Annotation_Python_Add_TextReplacement_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_TextStrikeout_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_TextStrikeout_Annotation import Annotation_Python_Add_TextStrikeout_Annotation | |
# Annotation_Python_Add_TextStrikeout_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_TextUnderline_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_TextUnderline_Annotation import Annotation_Python_Add_TextUnderline_Annotation | |
# Annotation_Python_Add_TextUnderline_Annotation.Run() | |
# print("* Executing Annotation_Python_Add_Watermark_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Add_Watermark_Annotation import Annotation_Python_Add_Watermark_Annotation | |
# Annotation_Python_Add_Watermark_Annotation.Run() | |
# print("* Executing Annotation_Python_Get_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Get_Annotation import Annotation_Python_Get_Annotation | |
# Annotation_Python_Get_Annotation.Run() | |
# print("* Executing Annotation_Python_Get_Export_Document...") | |
# from Working_With_Annotations.Annotation_Python_Get_Export_Document import Annotation_Python_Get_Export_Document | |
# Annotation_Python_Get_Export_Document.Run() | |
# print("* Executing Annotation_Python_Get_PDF...") | |
# from Working_With_Annotations.Annotation_Python_Get_PDF import Annotation_Python_Get_PDF | |
# Annotation_Python_Get_PDF.Run() | |
# print("* Executing Annotation_Python_Delete_Annotation...") | |
# from Working_With_Annotations.Annotation_Python_Delete_Annotation import Annotation_Python_Delete_Annotation | |
# Annotation_Python_Delete_Annotation.Run() | |
# ############################################################ | |
# print("*** Executing Working_With_Pages...") | |
# ############################################################ | |
# print("* Executing Annotation_Python_Get_Pages...") | |
# from Working_With_Pages.Annotation_Python_Get_Pages import Annotation_Python_Get_Pages | |
# Annotation_Python_Get_Pages.Run() | |
# print("* Executing Annotation_Python_Delete_Pages...") | |
# from Working_With_Pages.Annotation_Python_Delete_Pages import Annotation_Python_Delete_Pages | |
# Annotation_Python_Delete_Pages.Run() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Storage_Exist: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_StorageApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.StorageExistsRequest(Common_Utilities.myStorage) | |
response = api.storage_exists(request) | |
print("Expected response type is StorageExist: " + str(response)) | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import modules | |
import groupdocs_annotation_cloud | |
from Common_Utilities.Utils import Common_Utilities | |
class Annotation_Python_Upload_File: | |
@classmethod | |
def Run(self): | |
# Create instance of the API | |
api = Common_Utilities.Get_FileApi_Instance() | |
try: | |
request = groupdocs_annotation_cloud.UploadFileRequest("annotationdocs\\one-page.docx", "D:\\ewspace\\GroupDocs.Annotation.Cloud.Python.Examples\\src\\Resources\\annotationdocs\\one-page.docx", Common_Utilities.myStorage) | |
response = api.upload_file(request) | |
print("Expected response type is FilesUploadResult: " + str(response)) | |
except groupdocs_annotation_cloud.ApiException as e: | |
print("Exception while calling API: {0}".format(e.message)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create instance of the API | |
file_api = groupdocs_annotation_cloud.FileApi.from_config(configurations) | |
request = groupdocs_annotation_cloud.UploadFileRequest("one-page.docx", "C:\\Files\\one-page.docx", my_storage) | |
response = file_api.upload_file(request) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import groupdocs_annotation_cloud | |
class Common_Utilities: | |
# Get your app_sid and app_key at https://dashboard.groupdocs.cloud (free registration is required). | |
app_sid = None | |
app_key = None | |
host_url = None | |
myStorage = None | |
@classmethod | |
def Get_AnnotateApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_annotation_cloud.AnnotateApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_InfoApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_annotation_cloud.InfoApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_PreviewApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_annotation_cloud.PreviewApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_SignApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_annotation_cloud.SignApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_StorageApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_annotation_cloud.StorageApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_FolderApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_annotation_cloud.FolderApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Get_FileApi_Instance(self): | |
# Create instance of the API | |
return groupdocs_annotation_cloud.FileApi.from_keys(Common_Utilities.app_sid, Common_Utilities.app_key) | |
@classmethod | |
def Upload_Test_Files(self): | |
dirName = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "\\Resources\\annotationdocs\\" | |
print("dirName: " + dirName) | |
TestFiles = Common_Utilities.getListOfFiles(dirName) | |
# api initialization | |
storageApi = Common_Utilities.Get_StorageApi_Instance() | |
fileApi = Common_Utilities.Get_FileApi_Instance() | |
print("Files Count: " + str(len(TestFiles))) | |
for item in TestFiles: | |
print("File to Upload: "+ dirName + item) | |
# skip existing file uploading | |
fileExistRequest = groupdocs_annotation_cloud.ObjectExistsRequest(dirName + item) | |
fileExistsResponse = storageApi.object_exists(fileExistRequest) | |
if not fileExistsResponse.exists: | |
# file content uploading | |
putCreateRequest = groupdocs_annotation_cloud.UploadFileRequest('annotationdocs\\' + item, dirName + item) | |
fileApi.upload_file(putCreateRequest) | |
print("Uploaded missing file: "+ 'annotationdocs\\' + item) | |
print("File Uploading completed..") | |
@classmethod | |
def getListOfFiles(self, dirName): | |
# create a list of file and sub directories | |
# names in the given directory | |
listOfFile = os.listdir(dirName) | |
allFiles = list() | |
# Iterate over all the entries | |
for entry in listOfFile: | |
# Create full path | |
fullPath = os.path.join("", entry) | |
# If entry is a directory then get the list of files in this directory | |
if os.path.isdir(fullPath): | |
allFiles = allFiles + Common_Utilities.getListOfFiles(fullPath) | |
else: | |
allFiles.append(fullPath) | |
return allFiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment