Skip to content

Commit afb378a

Browse files
Add files via upload
1 parent f7c5568 commit afb378a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from annotations_helper import Config, PdfAnnotationsHelper, logging
2+
from asposepdfcloud import PdfApi, AnnotationsInfoResponse
3+
4+
class PdfGetAnnotationById:
5+
"""Class for managing PDF annotations using Aspose PDF Cloud API."""
6+
def __init__(self, pdf_api: PdfApi, helper: PdfAnnotationsHelper):
7+
self.pdfApi = pdf_api
8+
self.helper = helper
9+
10+
def request_annotation(self, annotation_id):
11+
"""Get annotation from the page in the PDF document."""
12+
if self.pdfApi:
13+
self.helper.uploadFile(Config.PDF_DOCUMENT_NAME, Config.LOCAL_FOLDER, Config.REMOTE_FOLDER)
14+
15+
args = {
16+
"folder": Config.REMOTE_FOLDER
17+
}
18+
response = self.pdfApi.get_text_annotation(Config.PDF_DOCUMENT_NAME, annotation_id, **args)
19+
if response.code == 200:
20+
logging.info(f"get_annotationn(): annotation '{annotation_id}' successfully found '{response.annotation.contents}' in the document '{Config.PDF_DOCUMENT_NAME}'.")
21+
else:
22+
logging.error(f"get_annotation(): Failed to get annotation in the document. Response code: {response.code}")

0 commit comments

Comments
 (0)