diff --git a/Uses-Cases/Annotations/Annotations.csproj b/Uses-Cases/Annotations/Annotations.csproj new file mode 100644 index 0000000..683240a --- /dev/null +++ b/Uses-Cases/Annotations/Annotations.csproj @@ -0,0 +1,14 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + diff --git a/Uses-Cases/Annotations/AnnotationsHelper.cs b/Uses-Cases/Annotations/AnnotationsHelper.cs new file mode 100644 index 0000000..212a51c --- /dev/null +++ b/Uses-Cases/Annotations/AnnotationsHelper.cs @@ -0,0 +1,111 @@ +using Aspose.Pdf.Cloud.Sdk.Api; +using Aspose.Pdf.Cloud.Sdk.Model; +using Newtonsoft.Json; + +namespace Annotations +{ + public class ConfigParams + { + public string CrdentialPath { get; } = "..\\credentials.json "; + public string LOCAL_FOLDER { get; } = "C:\\Samples"; + public string REMOTE_TEMP_FOLDER { get; } = "TempPdfCloud"; + public string PDF_DOCUMENT { get; } = "sample.pdf"; + public string PDF_OUTPUT { get; } = "output_sample.pdf"; + public int PAGE_NUMBER { get; } = 1; + + public string ANNOTATION_ID { get; } = "GE5TAOZTHA2CYMRZGUWDIMBZFQZTEMA"; + + public string NEW_HL_ANNOTATION_TEXT { get; } = "NEW HIGHLIGHT TEXT ANNOTATION"; + public string NEW_HL_ANNOTATION_DESCRIPTION { get; } = "This is a sample highlight annotation"; + public string NEW_HL_ANNOTATION_SUBJECT { get; } = "Highlight Text Box Subject"; + public string NEW_HL_ANNOTATION_CONTENTS { get; } = "Highlight annotation sample contents"; + + public string NEW_SO_ANNOTATION_TEXT { get; } = "NEW STRIKEOUT TEXT ANNOTATION"; + public string NEW_SO_ANNOTATION_DESCRIPTION { get; } = "This is a sample strikeout annotation"; + public string NEW_SO_ANNOTATION_SUBJECT { get; } = "Strikeout Text Box Subject"; + public string NEW_SO_ANNOTATION_CONTENTS { get; } = "Strikeout annotation sample contents"; + + public string NEW_UL_ANNOTATION_TEXT { get; } = "NEW UNDERLINE TEXT ANNOTATION"; + public string NEW_UL_ANNOTATION_DESCRIPTION { get; } = "This is a sample underline annotation"; + public string NEW_UL_ANNOTATION_SUBJECT { get; } = "Underline Text Box Subject"; + public string NEW_UL_ANNOTATION_CONTENTS { get; } = "Underline annotation sample contents"; + + public string NEW_FT_ANNOTATION_TEXT { get; } = "NEW FREE TEXT ANNOTATION"; + public string NEW_FT_ANNOTATION_DESCRIPTION { get; } = "This is a sample annotation"; + public string NEW_FT_ANNOTATION_SUBJECT { get; } = "Free Text Box Subject"; + public string NEW_FT_ANNOTATION_CONTENTS { get; } = "Free Text annotation sample contents"; + + public string REPLACED_CONTENT { get; } = "This is a replaced sample annotation"; + } + + public class Credentials + { + public string Id { get; set; } + public string Key { get; set; } + } + + public class AnnotationsHelper + { + public PdfApi pdfApi { get; private set; } + public ConfigParams config { get; private set; } + + public AnnotationsHelper() + { + config = new ConfigParams(); + string jsCredText = File.ReadAllText(config.CrdentialPath); + Credentials cred = JsonConvert.DeserializeObject(jsCredText); + pdfApi = new PdfApi(cred.Key, cred.Id); + } + + public async Task UploadFile(string fileName) + { + using (var file = File.OpenRead(Path.Combine(config.LOCAL_FOLDER, fileName))) + { + FilesUploadResult response = await pdfApi.UploadFileAsync(Path.Combine(config.REMOTE_TEMP_FOLDER, fileName), file); + if (response == null) + Console.WriteLine("UploadFile(): Unexpected error - no response!"); + else if (response.Errors != null && response.Errors.Count > 0) + foreach (var error in response.Errors) + Console.WriteLine("UploadFile(): {0} -> {1}", [error.Code, error.Message]); + else + Console.WriteLine("UploadFile(): File '{0}' successfully uploaded.", fileName); + } + } + + public async Task DownloadFile(string fileName, string outputName, string outputPrefix) + { + Stream stream = pdfApi.DownloadFile(Path.Combine(config.REMOTE_TEMP_FOLDER, fileName)); + using var fileStream = File.Create(Path.Combine(config.LOCAL_FOLDER, outputPrefix + outputName)); + stream.Position = 0; + await stream.CopyToAsync(fileStream); + Console.WriteLine("DownloadFile(): File '{0}' successfully downloaded.", outputPrefix + outputName); + } + + public async Task DeletePopupAnnotationsAsync(string documentName, string parentAnnotation, string remoteFolder) + { + // Delete popup annotations for typed parent annotation in the page in the PDF document. + PopupAnnotationsResponse response = await pdfApi.GetDocumentPopupAnnotationsAsync(documentName, folder: config.REMOTE_TEMP_FOLDER); + if (response == null) + Console.WriteLine("DeletePopupAnnotations(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("DeletePopupAnnotations(): Unexpected error '{0}'!", response.Status); + else + { + foreach (PopupAnnotationWithParent annotation in response.Annotations.List) + { + if (annotation.Parent.Id == parentAnnotation) + { + string popupContents = annotation.Contents; + AsposeResponse response2 = await pdfApi.DeleteAnnotationAsync(documentName, annotation.Id, folder: remoteFolder); + if (response2 == null) + Console.WriteLine("DeletePopupAnnotations(): Unexpected error!"); + else if (response2.Code < 200 || response2.Code > 299) + Console.WriteLine("DeletePopupAnnotations(): Failed to delete popup annotation '{0}' from the document.", popupContents); + else + Console.WriteLine("DeletePopupAnnotations(): popup annotations '{0}' with '{1}' contents deleted from the document '{1}.", annotation.Id, popupContents, documentName); + } + } + } + } + } +} diff --git a/Uses-Cases/Annotations/DeletePageAnnotations.cs b/Uses-Cases/Annotations/DeletePageAnnotations.cs new file mode 100644 index 0000000..ef90305 --- /dev/null +++ b/Uses-Cases/Annotations/DeletePageAnnotations.cs @@ -0,0 +1,22 @@ +using Aspose.Pdf.Cloud.Sdk.Model; + +namespace Annotations +{ + public class DeletePageAnnotations + { + public async static Task MakeDeleteAsync(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder) + { + // Delete annotation from the PDF document. + await helper.UploadFile(documentName); + AsposeResponse response = await helper.pdfApi.DeletePageAnnotationsAsync(documentName, pageNumber, folder: remoteFolder); + if (response == null) + Console.WriteLine("DeletePageAnnotations(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("DeletePageAnnotations(): Failed to delete annotation from the document."); + else { + Console.WriteLine("DeletePageAnnotations(): annotations on page '{0}' deleted from the document '{1}.", pageNumber, documentName); + await helper.DownloadFile(documentName, outputName, "del_page_annotations_"); + } + } + } +} diff --git a/Uses-Cases/Annotations/DeleteTextAnnotation.cs b/Uses-Cases/Annotations/DeleteTextAnnotation.cs new file mode 100644 index 0000000..43b1966 --- /dev/null +++ b/Uses-Cases/Annotations/DeleteTextAnnotation.cs @@ -0,0 +1,24 @@ +using Aspose.Pdf.Cloud.Sdk.Model; + +namespace Annotations +{ + public class DeleteTextAnnotation + { + public async static Task MakeDeleteAsync(AnnotationsHelper helper, string documentName, string annotationId, string outputName, string remoteFolder) + { + // Delete annotation from the PDF document. + await helper.UploadFile(documentName); + AsposeResponse response = await helper.pdfApi.DeleteAnnotationAsync(documentName, annotationId, folder: remoteFolder); + if (response == null) + Console.WriteLine("DeleteTextAnnotation(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("DeleteTextAnnotation(): Failed to delete annotation from the document."); + else + { + await helper.DeletePopupAnnotationsAsync(documentName, annotationId, remoteFolder); + Console.WriteLine("DeleteTextAnnotation(): annotations '{0}' deleted from the document '{1}.", annotationId, documentName); + await helper.DownloadFile(documentName, outputName, "del_text_annotations_"); + } + } + } +} diff --git a/Uses-Cases/Annotations/GetAnnotationById.cs b/Uses-Cases/Annotations/GetAnnotationById.cs new file mode 100644 index 0000000..ce3fbfe --- /dev/null +++ b/Uses-Cases/Annotations/GetAnnotationById.cs @@ -0,0 +1,23 @@ +using Aspose.Pdf.Cloud.Sdk.Model; + +namespace Annotations +{ + public class GetAnnotationById + { + public static async Task RequestTextAnnotationAsync(AnnotationsHelper helper, string documentName, string annotationId, string remoteFolder) + { + // Get annotation by Id in the PDF document. + await helper.UploadFile(documentName); + + string annotationResult = string.Empty; + TextAnnotationResponse response = await helper.pdfApi.GetTextAnnotationAsync(documentName, annotationId, folder: remoteFolder); + + if (response == null) + Console.WriteLine("RequestTextAnnotationAsync(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("RequestTextAnnotationAsync(): Failed to request text annotation from the document."); + else + Console.WriteLine("RequestTextAnnotationAsync(): annotation '{0}' with '{1}' contents successfully found in the document '{2}.", response.Annotation.Id, response.Annotation.Contents, documentName); + } + } +} diff --git a/Uses-Cases/Annotations/GetAnnotations.cs b/Uses-Cases/Annotations/GetAnnotations.cs new file mode 100644 index 0000000..f01b34d --- /dev/null +++ b/Uses-Cases/Annotations/GetAnnotations.cs @@ -0,0 +1,34 @@ +using Aspose.Pdf.Cloud.Sdk.Model; + +namespace Annotations +{ + public class GetAnnotations + { + public static async Task RequestAnnotationsOnPageAsync(AnnotationsHelper helper, string documentName, int pageNumber, string remoteFolder) + { + // Get annotations from the page in the PDF document. + await helper.UploadFile(documentName); + + string annotationResult = string.Empty; + AnnotationsInfoResponse response = await helper.pdfApi.GetPageAnnotationsAsync(documentName, pageNumber, folder: remoteFolder); + + if (response == null) + Console.WriteLine("RequestAnnotationsOnPageAsync(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("RequestAnnotationsOnPageAsync(): Failed to request annotations from the document."); + else + { + foreach (AnnotationInfo annotation in response.Annotations.List) + { + Console.WriteLine("RequestAnnotationsOnPageAsync(): annotation '{0}' with '{1}' contents get from the '{2}' page of the document '{3}.", [annotation.Id, annotation.Contents, pageNumber, documentName]); + if (string.IsNullOrEmpty(annotationResult) && + annotation.AnnotationType == AnnotationType.Text) + { + annotationResult = annotation.Id; + } + } + } + return annotationResult; + } + } +} \ No newline at end of file diff --git a/Uses-Cases/Annotations/NewFreetextAnnotation.cs b/Uses-Cases/Annotations/NewFreetextAnnotation.cs new file mode 100644 index 0000000..7464f00 --- /dev/null +++ b/Uses-Cases/Annotations/NewFreetextAnnotation.cs @@ -0,0 +1,47 @@ +using Aspose.Pdf.Cloud.Sdk.Model; + +namespace Annotations +{ + public class NewFreetextAnnotation + { + public static async Task Append(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder) + { + await helper.UploadFile(documentName); + + List annotations = new List + { + new FreeTextAnnotation( + Name: "Freetext_NEW_Annotation", + Rect: new Rectangle(100,350, 450,400), + Flags: new List() { AnnotationFlags.Default }, + HorizontalAlignment: HorizontalAlignment.Left, + Intent: FreeTextIntent.FreeTextTypeWriter, + Justification: Justification.Center, + RichText: helper.config.NEW_FT_ANNOTATION_TEXT, + Subject: helper.config.NEW_FT_ANNOTATION_SUBJECT, + Contents: helper.config.NEW_FT_ANNOTATION_CONTENTS, + Title: helper.config.NEW_FT_ANNOTATION_DESCRIPTION, + ZIndex: 1, + TextStyle: new TextStyle( + FontSize: 20, + Font: "Arial", + ForegroundColor: new Color( A: 0xFF, R: 0x00, G: 0xFF, B: 0x00), + BackgroundColor: new Color( A: 0xFF, R: 0xFF, G: 0x00, B: 0x00) + ), + Modified: "03/27/2025 00:00:00.000 AM" + ) + }; + AsposeResponse response = await helper.pdfApi.PostPageFreeTextAnnotationsAsync(documentName, pageNumber, annotations, folder: remoteFolder); + + if (response == null) + Console.WriteLine("NewFreetextAnnotation(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("NewFreetextAnnotation(): Failed to append text annotation to the document."); + else + { + Console.WriteLine("NewFreetextAnnotation(): annotations '{0}' added to the document '{1}.", helper.config.NEW_FT_ANNOTATION_TEXT, documentName); + await helper.DownloadFile(documentName, outputName, "add_text_annotation_"); + } + } + } +} diff --git a/Uses-Cases/Annotations/NewHighlightAnnotation.cs b/Uses-Cases/Annotations/NewHighlightAnnotation.cs new file mode 100644 index 0000000..af1511c --- /dev/null +++ b/Uses-Cases/Annotations/NewHighlightAnnotation.cs @@ -0,0 +1,47 @@ +using Aspose.Pdf.Cloud.Sdk.Model; + +namespace Annotations +{ + public class NewHighlightAnnotation + { + public static async Task Append(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder) + { + await helper.UploadFile(documentName); + + List annotations = new List + { + new HighlightAnnotation( + Name: "Highlight_NEW_Annotation", + Rect: new Rectangle(100,350, 450,400), + Flags: new List() { AnnotationFlags.Default }, + HorizontalAlignment: HorizontalAlignment.Left, + VerticalAlignment: VerticalAlignment.Top, + RichText: helper.config.NEW_HL_ANNOTATION_TEXT, + Subject: helper.config.NEW_HL_ANNOTATION_SUBJECT, + Contents: helper.config.NEW_HL_ANNOTATION_CONTENTS, + Title: helper.config.NEW_HL_ANNOTATION_DESCRIPTION, + ZIndex: 1, + Color: new Color(A: 0xFF, R: 0x00, G: 0xFF, B: 0x00), + QuadPoints: new List() { + new Point(X: 10, Y: 10), + new Point(X: 20, Y: 10), + new Point(X: 10, Y: 20), + new Point(X: 10, Y: 10) + }, + Modified: "03/27/2025 00:00:00.000 AM" + ) + }; + AsposeResponse response = await helper.pdfApi.PostPageHighlightAnnotationsAsync(documentName, pageNumber, annotations, folder: remoteFolder); + + if (response == null) + Console.WriteLine("NewHighlightAnnotation(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("NewHighlightAnnotation(): Failed to append highlight annotation to the document."); + else + { + Console.WriteLine("NewHighlightAnnotation(): annotations '{0}' added to the document '{1}.", helper.config.NEW_HL_ANNOTATION_TEXT, documentName); + await helper.DownloadFile(documentName, outputName, "add_highlight_annotation_"); + } + } + } +} diff --git a/Uses-Cases/Annotations/NewStrikeoutAnnotation.cs b/Uses-Cases/Annotations/NewStrikeoutAnnotation.cs new file mode 100644 index 0000000..a1ea831 --- /dev/null +++ b/Uses-Cases/Annotations/NewStrikeoutAnnotation.cs @@ -0,0 +1,47 @@ +using Aspose.Pdf.Cloud.Sdk.Model; + +namespace Annotations +{ + public class NewStrikeoutAnnotation + { + public static async Task Append(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder) + { + await helper.UploadFile(documentName); + + List annotations = new List + { + new StrikeOutAnnotation( + Name: "Strikeout_NEW_Annotation", + Rect: new Rectangle(100,350, 450,400), + Flags: new List() { AnnotationFlags.Default }, + HorizontalAlignment: HorizontalAlignment.Left, + VerticalAlignment: VerticalAlignment.Top, + RichText: helper.config.NEW_SO_ANNOTATION_TEXT, + Subject: helper.config.NEW_SO_ANNOTATION_SUBJECT, + Contents: helper.config.NEW_SO_ANNOTATION_CONTENTS, + Title: helper.config.NEW_SO_ANNOTATION_DESCRIPTION, + ZIndex: 1, + Color: new Color(A: 0xFF, R: 0x00, G: 0xFF, B: 0x00), + QuadPoints: new List() { + new Point(X: 10, Y: 10), + new Point(X: 20, Y: 10), + new Point(X: 10, Y: 20), + new Point(X: 10, Y: 10) + }, + Modified: "03/27/2025 00:00:00.000 AM" + ) + }; + AsposeResponse response = await helper.pdfApi.PostPageStrikeOutAnnotationsAsync(documentName, pageNumber, annotations, folder: remoteFolder); + + if (response == null) + Console.WriteLine("NewStrikeoutAnnotation(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("NewStrikeoutAnnotation(): Failed to append strikeout annotation to the document."); + else + { + Console.WriteLine("NewStrikeoutAnnotation(): annotations '{0}' added to the document '{1}.", helper.config.NEW_SO_ANNOTATION_TEXT, documentName); + await helper.DownloadFile(documentName, outputName, "add_strikeout_annotation_"); + } + } + } +} diff --git a/Uses-Cases/Annotations/NewUnderlineAnnotation.cs b/Uses-Cases/Annotations/NewUnderlineAnnotation.cs new file mode 100644 index 0000000..f786484 --- /dev/null +++ b/Uses-Cases/Annotations/NewUnderlineAnnotation.cs @@ -0,0 +1,47 @@ +using Aspose.Pdf.Cloud.Sdk.Model; + +namespace Annotations +{ + public class NewUnderlineAnnotation + { + public static async Task Append(AnnotationsHelper helper, string documentName, int pageNumber, string outputName, string remoteFolder) + { + await helper.UploadFile(documentName); + + List annotations = new List + { + new UnderlineAnnotation( + Name: "Underline_NEW_Annotation", + Rect: new Rectangle(100,350, 450,400), + Flags: new List() { AnnotationFlags.Default }, + HorizontalAlignment: HorizontalAlignment.Left, + VerticalAlignment: VerticalAlignment.Top, + RichText: helper.config.NEW_UL_ANNOTATION_TEXT, + Subject: helper.config.NEW_UL_ANNOTATION_SUBJECT, + Contents: helper.config.NEW_UL_ANNOTATION_CONTENTS, + Title: helper.config.NEW_UL_ANNOTATION_DESCRIPTION, + ZIndex: 1, + Color: new Color(A: 0xFF, R: 0x00, G: 0xFF, B: 0x00), + QuadPoints: new List() { + new Point(X: 10, Y: 10), + new Point(X: 20, Y: 10), + new Point(X: 10, Y: 20), + new Point(X: 10, Y: 10) + }, + Modified: "03/27/2025 00:00:00.000 AM" + ) + }; + AsposeResponse response = await helper.pdfApi.PostPageUnderlineAnnotationsAsync(documentName, pageNumber, annotations, folder: remoteFolder); + + if (response == null) + Console.WriteLine("NewUnderlineAnnotation(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("NewUnderlineAnnotation(): Failed to append underline annotation to the document."); + else + { + Console.WriteLine("NewUnderlineAnnotation(): annotations '{0}' added to the document '{1}.", helper.config.NEW_UL_ANNOTATION_TEXT, documentName); + await helper.DownloadFile(documentName, outputName, "add_underline_annotation_"); + } + } + } +} diff --git a/Uses-Cases/Annotations/Program.cs b/Uses-Cases/Annotations/Program.cs new file mode 100644 index 0000000..7e08780 --- /dev/null +++ b/Uses-Cases/Annotations/Program.cs @@ -0,0 +1,17 @@ +using Annotations; + +AnnotationsHelper helper = new AnnotationsHelper(); +ConfigParams config = helper.config; + +string annotationId = await GetAnnotations.RequestAnnotationsOnPageAsync(helper, config.PDF_DOCUMENT, config.PAGE_NUMBER, config.REMOTE_TEMP_FOLDER); +await GetAnnotationById.RequestTextAnnotationAsync(helper, config.PDF_DOCUMENT, annotationId, config.REMOTE_TEMP_FOLDER); + +await DeletePageAnnotations.MakeDeleteAsync(helper, config.PDF_DOCUMENT, config.PAGE_NUMBER, config.PDF_OUTPUT, config.REMOTE_TEMP_FOLDER); +await DeleteTextAnnotation.MakeDeleteAsync(helper, config.PDF_DOCUMENT, config.ANNOTATION_ID, config.PDF_OUTPUT, config.REMOTE_TEMP_FOLDER); + +await NewHighlightAnnotation.Append(helper, config.PDF_DOCUMENT, config.PAGE_NUMBER, config.PDF_OUTPUT, config.REMOTE_TEMP_FOLDER); +await NewStrikeoutAnnotation.Append(helper, config.PDF_DOCUMENT, config.PAGE_NUMBER, config.PDF_OUTPUT, config.REMOTE_TEMP_FOLDER); +await NewUnderlineAnnotation.Append(helper, config.PDF_DOCUMENT, config.PAGE_NUMBER, config.PDF_OUTPUT, config.REMOTE_TEMP_FOLDER); +await NewFreetextAnnotation.Append(helper, config.PDF_DOCUMENT, config.PAGE_NUMBER, config.PDF_OUTPUT, config.REMOTE_TEMP_FOLDER); + +await ReplaceAnnotation.ModifyAsync(helper, config.PDF_DOCUMENT, config.PDF_OUTPUT, config.ANNOTATION_ID, config.REMOTE_TEMP_FOLDER); \ No newline at end of file diff --git a/Uses-Cases/Annotations/ReplaceAnnotation.cs b/Uses-Cases/Annotations/ReplaceAnnotation.cs new file mode 100644 index 0000000..66a61d0 --- /dev/null +++ b/Uses-Cases/Annotations/ReplaceAnnotation.cs @@ -0,0 +1,47 @@ +using Aspose.Pdf.Cloud.Sdk.Model; +using System.Runtime.Intrinsics.X86; + +namespace Annotations +{ + public class ReplaceAnnotation + { + public static async Task GetAnnotationAsync(AnnotationsHelper helper, string documentName, string annotationId, string remoteFolder) + { + // Get annotation by Id in the PDF document. + TextAnnotation annotationResult = null; + TextAnnotationResponse response = await helper.pdfApi.GetTextAnnotationAsync(documentName, annotationId, folder: remoteFolder); + + if (response == null) + Console.WriteLine("GetAnnotationAsync(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("GetAnnotationAsync(): Failed to request text annotation from the document."); + else + { + Console.WriteLine("GetAnnotationAsync(): annotation '{0}' with '{1}' contents successfully found in the document '{2}.", response.Annotation.Id, response.Annotation.Contents, documentName); + annotationResult = response.Annotation; + } + return annotationResult; + } + + public static async Task ModifyAsync(AnnotationsHelper helper, string documentName, string outputName, string annotationId, string remoteFolder) + { + // Change annotation on the page in the PDF document. + await helper.UploadFile(documentName); + TextAnnotation annotation = await ReplaceAnnotation.GetAnnotationAsync(helper, documentName, annotationId, remoteFolder); + + annotation.Contents = helper.config.REPLACED_CONTENT; + annotation.Icon = TextIcon.Star; + + TextAnnotationResponse response = await helper.pdfApi.PutTextAnnotationAsync(documentName, annotationId, annotation, folder: remoteFolder); + if (response == null) + Console.WriteLine("ModifyAnnotation(): Unexpected error!"); + else if (response.Code < 200 || response.Code > 299) + Console.WriteLine("ModifyAnnotation(): Failed to request text annotation from the document."); + else + { + Console.WriteLine("ModifyAnnotation(): annotation '{0}' successfully modified in the document '{1}.", annotationId, documentName); + await helper.DownloadFile(documentName, outputName, "replaced_annotatiom_"); + } + } + } +} \ No newline at end of file