/// <summary>
        /// Removes annotations
        /// </summary>
        public static void RemoveAnnotation()
        {
            try
            {
                //ExStart:RemoveAnnotation
                // Create instance of annotator.
                AnnotationConfig cfg = CommonUtilities.GetConfiguration();

                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);

                IDocumentDataHandler documentRepository = annotator.GetDocumentDataHandler();
                if (!Directory.Exists(cfg.StoragePath))
                {
                    Directory.CreateDirectory(cfg.StoragePath);
                }

                // Create document data object in storage.
                var  document   = documentRepository.GetDocument("Document.pdf");
                long documentId = document != null ? document.Id : annotator.CreateDocument("Document.pdf");

                // Create annotation object
                AnnotationInfo pointAnnotation = new AnnotationInfo
                {
                    AnnotationPosition = new Point(852.0, 81.0),
                    Box          = new Rectangle(212f, 81f, 142f, 0.0f),
                    Type         = AnnotationType.Point,
                    PageNumber   = 0,
                    CreatorName  = "Anonym",
                    DocumentGuid = documentId
                };

                // Get all annotations from storage
                ListAnnotationsResult listAnnotationsResult = annotator.GetAnnotations(documentId);

                // Get annotation
                var annotation = annotator.GetAnnotation(listAnnotationsResult.Annotations[0].Guid);


                // Delete single annotation
                var deleteAnnotationResult = annotator.DeleteAnnotation(annotation.Id);

                //Delete all annotations
                annotator.DeleteAnnotations(documentId);
                //ExEnd:RemoveAnnotation
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Exemple #2
0
        /// <summary>
        /// Removes document annotations
        /// </summary>
        /// <param name="fileId">The document path to remove annotations from</param>
        public void DeleteAnnotations(string fileId)
        {
            var document = _documentSvc.GetDocument(fileId);

            _annotator.DeleteAnnotations(document.Id);
        }