public static void Run() { var apiInstance = new AnnotateApi(Constants.GetConfig()); try { var fileInfo = new FileInfo { FilePath = "one-page.docx" }; AnnotationInfo[] annotations = { new AnnotationInfo { AnnotationPosition = new Point{ X = 1, Y = 1 }, Box = new Rectangle{ X = 100, Y = 100, Width = 100, Height = 100 }, FontColor = 65535, FontSize = 12, Angle = 75, PageNumber = 0, Opacity = 0.7, Type = AnnotationInfo.TypeEnum.Watermark, Text = "This is watermark annotation", CreatorName = "Anonym A.", CreatedOn = DateTime.Now, Replies = new List <AnnotationReplyInfo> { new AnnotationReplyInfo { Comment = "First comment", RepliedOn = DateTime.Now }, new AnnotationReplyInfo { Comment = "Second comment", RepliedOn = DateTime.Now } } }, }; var options = new AnnotateOptions { FileInfo = fileInfo, Annotations = annotations.ToList(), OutputPath = "Output/output.docx" }; var link = apiInstance.Annotate(new AnnotateRequest(options)); Console.WriteLine("AddWatermarkAnnotation: Watermark Annotation added: " + link.Title); } catch (Exception e) { Console.WriteLine("Exception while calling AnnotateApi: " + e.Message); } }
public static void Run() { var apiInstance = new AnnotateApi(Constants.GetConfig()); try { var fileInfo = new FileInfo { FilePath = "one-page.docx" }; AnnotationInfo[] annotations = { new AnnotationInfo { Box = new Rectangle{ X = 250, Y = 35, Width = 102, Height = 12 }, PageNumber = 0, PenColor = 65535, PenStyle = AnnotationInfo.PenStyleEnum.Solid, PenWidth = 3, Opacity = 0.7, Type = AnnotationInfo.TypeEnum.Polyline, Text = "This is polyline annotation", CreatorName = "Anonym A.", CreatedOn = DateTime.Now, SvgPath = "M250.8280751173709,48.209295774647885l0.6986854460093896,0l0.6986854460093896,-1.3973708920187793l0.6986854460093896,0l0.6986854460093896,-1.3973708920187793l1.3973708920187793,-0.6986854460093896l0.6986854460093896,-0.6986854460093896l0.6986854460093896,0l2.096056338028169,-1.3973708920187793l3.493427230046948,-1.3973708920187793l0.6986854460093896,-0.6986854460093896l1.3973708920187793,-1.3973708920187793l0.6986854460093896,0l1.3973708920187793,-0.6986854460093896l0.6986854460093896,0l0.6986854460093896,-0.6986854460093896l0.6986854460093896,0l0.6986854460093896,0l0,-0.6986854460093896l0.6986854460093896,0l0.6986854460093896,0l1.3973708920187793,0l0,-0.6986854460093896l0.6986854460093896,0l1.3973708920187793,0l0.6986854460093896,0l1.3973708920187793,0l0.6986854460093896,0l2.096056338028169,-0.6986854460093896l1.3973708920187793,0l0.6986854460093896,0l0.6986854460093896,0l1.3973708920187793,0l1.3973708920187793,0l1.3973708920187793,0l2.096056338028169,0l5.589483568075117,0l1.3973708920187793,0l2.096056338028169,0l0.6986854460093896,0l1.3973708920187793,0l0.6986854460093896,0l1.3973708920187793,0l1.3973708920187793,0l0.6986854460093896,0.6986854460093896l1.3973708920187793,0l2.096056338028169,1.3973708920187793l0.6986854460093896,0l0.6986854460093896,0l0,0.6986854460093896l1.3973708920187793,0l0.6986854460093896,0.6986854460093896l1.3973708920187793,0.6986854460093896l0,0.6986854460093896l0.6986854460093896,0l1.3973708920187793,0.6986854460093896l1.3973708920187793,0.6986854460093896l3.493427230046948,0.6986854460093896l1.3973708920187793,0.6986854460093896l2.096056338028169,0.6986854460093896l1.3973708920187793,0.6986854460093896l1.3973708920187793,0l1.3973708920187793,0.6986854460093896l0.6986854460093896,0l0.6986854460093896,0.6986854460093896l1.3973708920187793,0l0.6986854460093896,0l0.6986854460093896,0l2.7947417840375586,0l1.3973708920187793,0l0.6986854460093896,0l1.3973708920187793,0l0.6986854460093896,0l0.6986854460093896,0l1.3973708920187793,0l0.6986854460093896,0l2.7947417840375586,0l0.6986854460093896,0l2.7947417840375586,0l1.3973708920187793,0l0.6986854460093896,0l0.6986854460093896,0l0.6986854460093896,0l0.6986854460093896,0l0.6986854460093896,0l0.6986854460093896,0l0.6986854460093896,-0.6986854460093896l0.6986854460093896,0", Replies = new List <AnnotationReplyInfo> { new AnnotationReplyInfo { Comment = "First comment", RepliedOn = DateTime.Now }, new AnnotationReplyInfo { Comment = "Second comment", RepliedOn = DateTime.Now } } }, }; var options = new AnnotateOptions { FileInfo = fileInfo, Annotations = annotations.ToList(), OutputPath = "Output/output.docx" }; var link = apiInstance.Annotate(new AnnotateRequest(options)); Console.WriteLine("AddPolylineAnnotation: Polyline Annotation added: " + link.Title); } catch (Exception e) { Console.WriteLine("Exception while calling AnnotateApi: " + e.Message); } }
public static void Run() { var apiInstance = new AnnotateApi(Constants.GetConfig()); try { var fileInfo = new FileInfo { FilePath = "one-page.docx" }; AnnotationInfo[] annotations = { new AnnotationInfo { Box = new Rectangle{ X = 100, Y = 100, Width = 200, Height = 100 }, PageNumber = 0, Type = AnnotationInfo.TypeEnum.Image, ImagePath = "JohnSmith.png", Text = "This is image annotation", CreatorName = "Anonym A.", CreatedOn = DateTime.Now, Replies = new List <AnnotationReplyInfo> { new AnnotationReplyInfo { Comment = "First comment", RepliedOn = DateTime.Now }, new AnnotationReplyInfo { Comment = "Second comment", RepliedOn = DateTime.Now } } }, }; var options = new AnnotateOptions { FileInfo = fileInfo, Annotations = annotations.ToList(), OutputPath = "Output/output.docx" }; var link = apiInstance.Annotate(new AnnotateRequest(options)); Console.WriteLine("AddImageAnnotation: Image Annotation added: " + link.Title); } catch (Exception e) { Console.WriteLine("Exception while calling AnnotateApi: " + e.Message); } }
public void TestAddAnnotationsManyPages(string filePath) { var fileInfo = new Model.FileInfo { FilePath = filePath }; var options = new AnnotateOptions { FileInfo = fileInfo, Annotations = GetAnnotationsManyPages(), OutputPath = $"{DefaultOutputPath}/{Path.GetFileName(filePath)}" }; var request = new AnnotateRequest(options); var result = AnnotateApi.Annotate(request); Assert.IsNotNull(result); Assert.IsNotEmpty(result.Href); }
public static void Run() { var apiInstance = new AnnotateApi(Constants.GetConfig()); try { var fileInfo = new FileInfo { FilePath = "one-page.docx" }; AnnotationInfo[] annotations = { new AnnotationInfo { Points = new List <Point> { new Point { X = 80, Y = 730 }, new Point{ X = 240, Y = 730 }, new Point{ X = 80, Y = 650 }, new Point{ X = 240, Y = 650 } }, FontColor = 65535, PageNumber = 0, Opacity = 0.7, Type = AnnotationInfo.TypeEnum.TextReplacement, Text = "This is text replacement annotation", TextToReplace = "replaced text", CreatorName = "Anonym A.", CreatedOn = DateTime.Now, Replies = new List <AnnotationReplyInfo> { new AnnotationReplyInfo { Comment = "First comment", RepliedOn = DateTime.Now }, new AnnotationReplyInfo { Comment = "Second comment", RepliedOn = DateTime.Now } } }, }; var options = new AnnotateOptions { FileInfo = fileInfo, Annotations = annotations.ToList(), OutputPath = "Output/output.docx" }; var link = apiInstance.Annotate(new AnnotateRequest(options)); Console.WriteLine("AddTextReplacementAnnotation: Text Replacement Annotation added: " + link.Title); } catch (Exception e) { Console.WriteLine("Exception while calling AnnotateApi: " + e.Message); } }
public static void Run() { var apiInstance = new AnnotateApi(Constants.GetConfig()); try { var fileInfo = new FileInfo { FilePath = "ten-pages.pdf" }; AnnotationInfo[] annotations = { new AnnotationInfo { AnnotationPosition = new Point{ X = 1, Y = 1 }, Box = new Rectangle{ X = 100, Y = 100, Width = 100, Height = 100 }, PageNumber = 1, BackgroundColor = 65535, PenColor = 65535, PenStyle = AnnotationInfo.PenStyleEnum.Solid, PenWidth = 3, Opacity = 0.7, Type = AnnotationInfo.TypeEnum.Area, Text = "This is area annotation", CreatorName = "Anonym A.", Replies = new List <AnnotationReplyInfo> { new AnnotationReplyInfo { Comment = "First comment", RepliedOn = DateTime.Now }, new AnnotationReplyInfo { Comment = "Second comment", RepliedOn = DateTime.Now } } }, new AnnotationInfo { AnnotationPosition = new Point{ X = 852, Y = 59.388262910798119 }, Box = new Rectangle{ X = 375.89276123046875, Y = 59.388263702392578, Width = 88.7330551147461, Height = 37.7290153503418 }, PageNumber = 2, PenColor = 1201033, PenStyle = 0, PenWidth = 1, Type = AnnotationInfo.TypeEnum.Area, CreatorName = "Anonym A." }, new AnnotationInfo { AnnotationPosition = new Point{ X = 852, Y = 59.388262910798119 }, Box = new Rectangle{ X = 375.89276123046875, Y = 59.388263702392578, Width = 88.7330551147461, Height = 37.7290153503418 }, PageNumber = 4, Type = AnnotationInfo.TypeEnum.Point, CreatorName = "Anonym A." }, new AnnotationInfo { AnnotationPosition = new Point{ X = 852, Y = 59.388262910798119 }, Box = new Rectangle{ X = 375.89276123046875, Y = 59.388263702392578, Width = 88.7330551147461, Height = 37.7290153503418 }, PageNumber = 5, PenColor = 1201033, PenStyle = 0, PenWidth = 1, Type = AnnotationInfo.TypeEnum.Arrow, CreatorName = "Anonym A." } }; var options = new AnnotateOptions { FileInfo = fileInfo, Annotations = annotations.ToList(), OutputPath = "Output/output.pdf" }; var link = apiInstance.Annotate(new AnnotateRequest(options)); Console.WriteLine("AddMultipleAnnotations: Multiple Annotation added: " + link.Title); } catch (Exception e) { Console.WriteLine("Exception while calling AnnotateApi: " + e.Message); } }