Beispiel #1
0
        /// <summary>
        /// Moves annotation marker
        /// </summary>
        public static void MoveAnnotationResult()
        {
            try
            {
                //ExStart:MoveAnnotationResult
                // Create path finder
                IRepositoryPathFinder pathFinder = new RepositoryPathFinder();
                var documentRepository           = new DocumentRepository(pathFinder);

                // Create instance of annotator
                IAnnotator annotator = new Annotator(
                    new UserRepository(pathFinder),
                    new DocumentRepository(pathFinder),
                    new AnnotationRepository(pathFinder),
                    new AnnotationReplyRepository(pathFinder),
                    new AnnotationCollaboratorRepository(pathFinder));

                // 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 areaAnnotation = new AnnotationInfo
                {
                    AnnotationPosition = new Point(852.0, 271.7),
                    BackgroundColor    = 3355443,
                    Box          = new Rectangle(466f, 271f, 69f, 62f),
                    PageNumber   = 0,
                    PenColor     = 3355443,
                    Type         = AnnotationType.Area,
                    CreatorName  = "Anonym",
                    DocumentGuid = documentId
                };

                //Add annotation to storage
                CreateAnnotationResult createAreaAnnotationResult = annotator.CreateAnnotation(areaAnnotation);

                //Move annotation marker
                MoveAnnotationResult moveAnnotationResult = annotator.MoveAnnotationMarker(createAreaAnnotationResult.Id,
                                                                                           new Point(200, 200), /*NewPageNumber*/ 1);
                //ExEnd:MoveAnnotationResult
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }