public ActionResult Get(string file)
        {
            Response.AddHeader("Content-Type", "application/json");
            AnnotationImageHandler handler = Utils.createAnnotationImageHandler();

            int    pageNumber = int.Parse(Request.Params["page"]);
            String filename   = file;

            List <RowData>        result = new List <RowData>();
            DocumentInfoContainer documentInfoContainer = handler.GetDocumentInfo(filename);

            foreach (PageData pageData in documentInfoContainer.Pages)
            {
                if (pageData.Number == pageNumber)
                {
                    result = pageData.Rows;
                    break;
                }
            }
            return(Content(JsonConvert.SerializeObject(
                               result,
                               Formatting.Indented,
                               new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }
                               ), "application/json"));
        }
Esempio n. 2
0
        /// <summary>
        /// Removes all annotations in Images document
        /// </summary>
        public static void RemoveAllAnnotationsFromDocument()
        {
            try
            {
                //ExStart:RemoveAllAnnotationsFromDocument
                // Create instance of annotator.
                AnnotationConfig cfg = CommonUtilities.GetConfiguration();

                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);

                // Get input file stream
                Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite);

                // Get output file stream
                Stream result = annotator.RemoveAnnotationStream(inputFile, DocumentType.Images);

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.png"), FileMode.Create))
                {
                    byte[] buffer = new byte[result.Length];
                    result.Seek(0, SeekOrigin.Begin);
                    result.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
                //ExEnd:RemoveAllAnnotationsFromDocument
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        /// <summary>
        /// Picks the annotations from document.pdf and exports them to sample.pdf
        /// </summary>
        public static void ExportAnnotationInFile()
        {
            try
            {
                //ExStart:ExportAnnotationInFile
                // Create instance of annotator.
                AnnotationConfig cfg = CommonUtilities.GetConfiguration();

                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);

                // Get file stream
                Stream manifestResourceStream     = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite);
                List <AnnotationInfo> annotations = new List <AnnotationInfo>();

                Stream stream = annotator.ExportAnnotationsToDocument(manifestResourceStream, annotations, DocumentType.Pdf);

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.pdf"), FileMode.Create))
                {
                    byte[] buffer = new byte[stream.Length];
                    stream.Seek(0, SeekOrigin.Begin);
                    stream.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
                //ExEnd:ExportAnnotationInFile
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        /// <summary>Registers the type mappings with the Unity container.</summary>
        /// <param name="container">The unity container to configure.</param>
        /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to 
        /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks>
        public static void RegisterTypes(IUnityContainer container)
        {
            // NOTE: To load from web.config uncomment the line below. Make sure to add a Microsoft.Practices.Unity.Configuration to the using statements.
            // container.LoadConfiguration();
            container.RegisterType<IHtmlString, AnnotationWidget>("AnnotationWidget");

            string repositoryFolder = AppDomain.CurrentDomain.GetData("DataDirectory") + "/";
            var annotator = new AnnotationImageHandler(
               new AnnotationConfig { StoragePath = repositoryFolder }
                //new Data.Json.Repositories.UserRepository(repositoryFolder),
                //new Data.Json.Repositories.DocumentRepository(repositoryFolder),
                //new Data.Json.Repositories.AnnotationRepository(repositoryFolder),
                //new Data.Json.Repositories.AnnotationReplyRepository(repositoryFolder),
                //new Data.Json.Repositories.AnnotationCollaboratorRepository(repositoryFolder)
                );

            container.RegisterInstance(typeof(IUserDataHandler), annotator.GetUserDataHandler());

            #region Instances
            //container.RegisterInstance(typeof (IDocumentDataHandler), new DocumentRepository(repositoryFolder));
            //container.RegisterInstance(typeof(IAnnotationCollaboratorDataHandler), new AnnotationCollaboratorRepository(repositoryFolder));
            //container.RegisterInstance(typeof(IAnnotationReplyDataHandler), new AnnotationReplyRepository(repositoryFolder));
            //container.RegisterInstance(typeof(IAnnotationDataHandler), new AnnotationRepository(repositoryFolder));
            //container.RegisterInstance(typeof(IInputDataHandler), new InputDataHandler(repositoryFolder));
            //container.RegisterInstance(typeof(IFileDataStore), new FileStore(repositoryFolder));
            #endregion Instances
            
            container.RegisterInstance(typeof(AnnotationImageHandler), annotator);
            container.RegisterType<IAnnotationService, AnnotationService>();
            container.RegisterType<IAuthenticationService, AuthenticationService>();
            container.RegisterType<IAnnotationBroadcaster, AnnotationBroadcaster>();
            container.RegisterType<IAnnotationHub, AnnotationHub>();
        }
        /// <summary>
        /// Gets annotations from the storage file
        /// </summary>
        /// <returns>Returns a list of annotations</returns>
        public static ListAnnotationsResult GetAllDocumentAnnotation()
        {
            try
            {
                //ExStart:GetAllAnnotation
                // 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");

                // Get annotation from storage
                ListAnnotationsResult result = annotator.GetAnnotations(documentId);

                return(result);
                //ExEnd:GetAllAnnotation
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
                return(null);
            }
        }
        /// <summary>
        /// Creates a document data object in the storage
        /// </summary>
        public static void CreateDocument()
        {
            try
            {
                //ExStart:CreateDocument
                // 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("sample.pdf");
                long documentId = document != null ? document.Id : annotator.CreateDocument("sample.pdf");

                Console.WriteLine("Document ID : " + documentId);
                //ExEnd:CreateDocument
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Esempio n. 7
0
        //ExEnd:GetConfiguration

        //ExStart:GetImageRepresentation
        /// <summary>
        /// Gets image representation of document
        /// </summary>
        /// <param name="CommonUtilities.filePath">Source file path</param>
        public static void GetImageRepresentation(string filePath)
        {
            try
            {
                Stream           document = new FileStream(MapSourceFilePath(filePath), FileMode.Open);
                AnnotationConfig cfg      = GetConfiguration();

                AnnotationImageHandler annotationHandler = new AnnotationImageHandler(cfg);

                List <PageImage> images = annotationHandler.GetPages(document, new ImageOptions());

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(MapDestinationFilePath("image.png"), FileMode.Create))
                {
                    byte[] buffer = new byte[images[0].Stream.Length];
                    images[0].Stream.Seek(0, SeekOrigin.Begin);
                    images[0].Stream.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        /// <summary>
        /// Get Image Representation of Pages for PDF
        /// </summary>
        public static void GetImageRepresentationOfPagesForPDF()
        {
            try
            {
                //ExStart:GetImageRepresentationOfPagesForPDF
                // Create instance of annotator.
                AnnotationConfig cfg = CommonUtilities.GetConfiguration();

                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);

                // Get input file stream
                Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite);

                List <PageImage> images = annotator.GetPages(inputFile, new ImageOptions {
                    WithoutAnnotations = true
                });

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.png"), FileMode.Create))
                {
                    byte[] buffer = new byte[images[0].Stream.Length];
                    images[0].Stream.Seek(0, SeekOrigin.Begin);
                    images[0].Stream.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
                //ExEnd:GetImageRepresentationOfPagesForPDF
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        /// <summary>
        /// Assigns/sets document access rights
        /// </summary>
        public static void AssignAccessRights()
        {
            try
            {
                //ExStart:AssignAccessRight
                // 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");

                // Set document access rights
                annotator.SetDocumentAccessRights(documentId, AnnotationReviewerRights.All);
                //ExEnd:AssignAccessRight
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        /// <summary>Registers the type mappings with the Unity container.</summary>
        /// <param name="container">The unity container to configure.</param>
        /// <remarks>There is no need to register concrete types such as controllers or API controllers (unless you want to
        /// change the defaults), as Unity allows resolving a concrete type even if it was not previously registered.</remarks>
        public static void RegisterTypes(IUnityContainer container)
        {
            // NOTE: To load from web.config uncomment the line below. Make sure to add a Microsoft.Practices.Unity.Configuration to the using statements.
            // container.LoadConfiguration();
            container.RegisterType <IHtmlString, AnnotationWidget>("AnnotationWidget");

            string repositoryFolder = AppDomain.CurrentDomain.GetData("DataDirectory") + "/";
            var    annotator        = new AnnotationImageHandler(
                new AnnotationConfig {
                StoragePath = repositoryFolder
            }
                //new Data.Json.Repositories.UserRepository(repositoryFolder),
                //new Data.Json.Repositories.DocumentRepository(repositoryFolder),
                //new Data.Json.Repositories.AnnotationRepository(repositoryFolder),
                //new Data.Json.Repositories.AnnotationReplyRepository(repositoryFolder),
                //new Data.Json.Repositories.AnnotationCollaboratorRepository(repositoryFolder)
                );

            container.RegisterInstance(typeof(IUserDataHandler), annotator.GetUserDataHandler());

            #region Instances
            //container.RegisterInstance(typeof (IDocumentDataHandler), new DocumentRepository(repositoryFolder));
            //container.RegisterInstance(typeof(IAnnotationCollaboratorDataHandler), new AnnotationCollaboratorRepository(repositoryFolder));
            //container.RegisterInstance(typeof(IAnnotationReplyDataHandler), new AnnotationReplyRepository(repositoryFolder));
            //container.RegisterInstance(typeof(IAnnotationDataHandler), new AnnotationRepository(repositoryFolder));
            //container.RegisterInstance(typeof(IInputDataHandler), new InputDataHandler(repositoryFolder));
            //container.RegisterInstance(typeof(IFileDataStore), new FileStore(repositoryFolder));
            #endregion Instances

            container.RegisterInstance(typeof(AnnotationImageHandler), annotator);
            container.RegisterType <IAnnotationService, AnnotationService>();
            container.RegisterType <IAuthenticationService, AuthenticationService>();
            container.RegisterType <IAnnotationBroadcaster, AnnotationBroadcaster>();
            container.RegisterType <IAnnotationHub, AnnotationHub>();
        }
Esempio n. 11
0
        public ActionResult Post(string file)
        {
            Response.AddHeader("Content-Type", "application/json");
            AnnotationImageHandler imageHandler        = Utils.createAnnotationImageHandler();
            IDocumentDataHandler   documentDataHandler = imageHandler.GetDocumentDataHandler();

            String   filename   = file;
            Document doc        = documentDataHandler.GetDocument(filename);
            long     documentId = doc != null ? doc.Id : imageHandler.CreateDocument(filename);

            //StreamReader stream = new StreamReader(Request.InputStream);
            //string x = stream.ReadToEnd();  // added to view content of input stream

            AnnotationInfo annotation = new AnnotationInfo(); //Request.InputStream as AnnotationInfo;

            annotation.DocumentGuid = documentId;
            CreateAnnotationResult result = imageHandler.CreateAnnotation(annotation);

            return(Content(JsonConvert.SerializeObject(
                               result,
                               Formatting.Indented,
                               new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }
                               ), "application/json"));
        }
        //ExEnd:GetImageRepresentation

        //ExStart:GetTextCoordinatesInImage
        /// <summary>
        /// Gets text coordinates in image representation of document
        /// </summary>
        /// <param name="CommonUtilities.filePath">Source file path</param>
        public static void GetTextCoordinates(string filePath)
        {
            try
            {
                // Set configuration
                AnnotationConfig cfg = GetConfiguration();

                // Initialize annotator
                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
                try
                {
                    annotator.CreateDocument(filePath);
                }
                catch { }

                var documentInfoContainer = annotator.GetDocumentInfo(filePath);

                // Go through all pages
                foreach (PageData pageData in documentInfoContainer.Pages)
                {
                    Console.WriteLine("Page number: " + pageData.Number);

                    //Go through all page rows
                    for (int i = 0; i < pageData.Rows.Count; i++)
                    {
                        RowData rowData = pageData.Rows[i];

                        // Write data to console
                        Console.WriteLine("Row: " + (i + 1));
                        Console.WriteLine("Text: " + rowData.Text);
                        Console.WriteLine("Text width: " + rowData.LineWidth);
                        Console.WriteLine("Text height: " + rowData.LineHeight);
                        Console.WriteLine("Distance from left: " + rowData.LineLeft);
                        Console.WriteLine("Distance from top: " + rowData.LineTop);

                        // Get words
                        string[] words = rowData.Text.Split(' ');

                        // Go through all word coordinates
                        for (int j = 0; j < words.Length; j++)
                        {
                            int coordinateIndex = j == 0 ? 0 : j + 1;
                            // Write data to console
                            Console.WriteLine(string.Empty);
                            Console.WriteLine("Word:'" + words[j] + "'");
                            Console.WriteLine("Word distance from left: " + rowData.TextCoordinates[coordinateIndex]);
                            Console.WriteLine("Word width: " + rowData.TextCoordinates[coordinateIndex + 1]);
                            Console.WriteLine(string.Empty);
                        }
                        Console.ReadKey();
                    }
                }
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
            //ExEnd:GetTextCoordinatesInImage
        }
        /// <summary>
        /// Updates the text in the annotation
        /// </summary>
        public static void EditTextFieldAnnotation()
        {
            try
            {
                //ExStart:EditTextFieldAnnotation
                // 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 textFieldAnnotation = new AnnotationInfo
                {
                    AnnotationPosition = new Point(852.0, 201.0),
                    FieldText          = "text in the box",
                    FontFamily         = "Arial",
                    FontSize           = 10,
                    Box          = new Rectangle(66f, 201f, 64f, 37f),
                    PageNumber   = 0,
                    Type         = AnnotationType.TextField,
                    CreatorName  = "Anonym",
                    DocumentGuid = documentId
                };

                //Add annotation to storage
                CreateAnnotationResult createTextFieldAnnotationResult = annotator.CreateAnnotation(textFieldAnnotation);

                // Update text in the annotation
                SaveAnnotationTextResult saveTextFieldResult = annotator.SaveTextField(
                    createTextFieldAnnotationResult.Id,
                    new TextFieldInfo
                {
                    FieldText  = "new text",
                    FontFamily = "Colibri",
                    FontSize   = 12
                });


                // Set text field color
                SaveAnnotationTextResult saveTextFieldColorResult = annotator.SetTextFieldColor
                                                                        (createTextFieldAnnotationResult.Id, 16753920);
                //ExEnd:EditTextFieldAnnotation
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        /// <summary>
        /// Adds reply to the annotation, edits reply, creates child reply
        /// </summary>
        public static void AddAnnotationReply()
        {
            try
            {
                //ExStart:AddAnnotationReply
                // 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
                };

                // Add annotation to storage
                var createPointAnnotationResult = annotator.CreateAnnotation(pointAnnotation);

                // Add simple reply to created annotation
                var addSimpleReplyResult = annotator.CreateAnnotationReply(createPointAnnotationResult.Id, "first question");

                // Edit created reply
                var editReplyResult = annotator.EditAnnotationReply(addSimpleReplyResult.ReplyGuid, "changed question");

                // Create child reply. This reply will be linked to previously created reply.
                var addChildReplyResult = annotator.CreateAnnotationReply(createPointAnnotationResult.Id, "answer", addSimpleReplyResult.ReplyGuid);

                // Delete annotation reply by guid
                var deleteReplyResult = annotator.DeleteAnnotationReply(addChildReplyResult.ReplyGuid);

                // Delete all replies from annotation
                annotator.DeleteAnnotationReplies(createPointAnnotationResult.Id);

                // List of replies after deleting all replies
                var listRepliesResultAfterDeleteAll = annotator.ListAnnotationReplies(createPointAnnotationResult.Id);
                //ExEnd:AddAnnotationReply
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        public static AnnotationImageHandler createAnnotationImageHandler()
        {
            AnnotationConfig cfg = new AnnotationConfig();

            cfg.StoragePath = getStoragePath();
            AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);

            return(annotator);
        }
        /// <summary>
        /// Get Password Protected Documents
        /// </summary>
        public static FileContainer GetPasswordProtectedDocuments(Stream protectedDocument, String password)
        {
            //ExStart:GetPasswordProtectedDocuments
            AnnotationConfig       cfg       = CommonUtilities.GetConfiguration();
            AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);

            FileContainer convertedDocument = annotator.GetPdfFile(protectedDocument, password);

            return(convertedDocument);

            //ExEnd:GetPasswordProtectedDocuments
        }
Esempio n. 17
0
        public ActionResult Get(string guid)
        {
            Response.AddHeader("Content-Type", "application/json");

            AnnotationImageHandler imageHandler = Utils.createAnnotationImageHandler();

            return(Content(JsonConvert.SerializeObject(
                               imageHandler.GetAnnotation(guid).Annotation,
                               Formatting.Indented,
                               new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }
                               ), "application/json"));
        }
        /// <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);
            }
        }
        /// <summary>
        /// Resizes the existing annotations
        /// </summary>
        public static void ResizeAnnotationResult()
        {
            try
            {
                //ExStart:ResizeAnnotationResult
                // 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 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);

                //Resize annotation
                ResizeAnnotationResult resizeResult = annotator.ResizeAnnotation(createAreaAnnotationResult.Id, new AnnotationSizeInfo
                {
                    Height = 80,
                    Width  = 60
                });
                //ExEnd:ResizeAnnotationResult
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Esempio n. 20
0
        public ActionResult Post()
        {
            Response.AddHeader("Content-Type", "application/json");
            AnnotationImageHandler imageHandler = Utils.createAnnotationImageHandler();
            String         guid           = Request.Params["guid"];
            String         section        = Request.Params["guid"];
            AnnotationInfo annotationInfo = imageHandler.GetAnnotation(guid).Annotation;
            long           annotationId   = imageHandler.GetAnnotation(guid).Id;

            switch (section)
            {
            case "fieldtext":
                var jsonString = String.Empty;
                using (var inputStream = new StreamReader(Request.InputStream))
                {
                    jsonString = inputStream.ReadToEnd();
                }
                TextFieldInfo info = JsonConvert.DeserializeObject <TextFieldInfo>(jsonString);

                SaveAnnotationTextResult result = imageHandler.SaveTextField(annotationId, info);
                return(Content(JsonConvert.SerializeObject(
                                   result,
                                   Formatting.Indented,
                                   new JsonSerializerSettings {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                }
                                   ), "application/json"));

            case "position":
                var jsonStringPos = String.Empty;
                using (var inputStream = new StreamReader(Request.InputStream))
                {
                    jsonStringPos = inputStream.ReadToEnd();
                }
                Point point = JsonConvert.DeserializeObject <Point>(jsonStringPos);

                MoveAnnotationResult moveresult = imageHandler.MoveAnnotationMarker(annotationId, point, annotationInfo.PageNumber);
                return(Content(JsonConvert.SerializeObject(
                                   moveresult,
                                   Formatting.Indented,
                                   new JsonSerializerSettings {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                }
                                   ), "application/json"));

            default:
                return(Content(null));
            }
        }
        /// <summary>
        /// Adds Watermark annotation in Diagrams
        /// </summary>
        public static void AddWatermarkAnnotationInDiagrams()
        {
            try
            {
                //ExStart:AddWatermarkAnnotationInDiagrams
                // Create instance of annotator.
                AnnotationConfig       cfg       = CommonUtilities.GetConfiguration();
                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
                // Get input file stream
                Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite);

                // Initialize list of AnnotationInfo
                List <AnnotationInfo> annotations = new List <AnnotationInfo>();

                // Initialize watermark annotation
                AnnotationInfo watermarkAnnnotation = new AnnotationInfo()
                {
                    Box        = new Rectangle(165.41f, 192.24f, 177.8f, 38.29f),
                    CreatedOn  = DateTime.Now,
                    FieldText  = "Watermark text",
                    FontColor  = 16711680,
                    FontFamily = "Microsoft Sans Serif",
                    FontSize   = 17,
                    Opacity    = 0.3,
                    Type       = AnnotationType.Watermark,
                };

                // Add annotation to list
                annotations.Add(watermarkAnnnotation);

                // Get output file stream
                Stream result = annotator.ExportAnnotationsToDocument(inputFile, annotations);

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.vsdx"), FileMode.Create))
                {
                    byte[] buffer = new byte[result.Length];
                    result.Seek(0, SeekOrigin.Begin);
                    result.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
                //ExEnd:AddWatermarkAnnotationInDiagrams
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Esempio n. 22
0
        public ActionResult Get(string file)
        {
            AnnotationImageHandler handler = Utils.createAnnotationImageHandler();
            String filename = file;
            DocumentInfoContainer result = handler.GetDocumentInfo(filename);

            Response.AddHeader("Content-Type", "application/json");
            return(Content(JsonConvert.SerializeObject(
                               result,
                               Formatting.Indented,
                               new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }
                               ), "application/json"));
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public AnnotationApiController()
        {
            GlobalConfiguration = new Common.Config.GlobalConfiguration();
            // create annotation directories
            DirectoryUtils = new DirectoryUtils(GlobalConfiguration.Annotation);

            // create annotation application configuration
            AnnotationConfig config = new AnnotationConfig();

            // set storage path
            config.StoragePath = DirectoryUtils.FilesDirectory.GetPath();
            // set directory to store annotted documents
            GlobalConfiguration.Annotation.OutputDirectory = DirectoryUtils.OutputDirectory.GetPath();
            // initialize Annotation instance for the Image mode
            AnnotationImageHandler = new AnnotationImageHandler(config);
        }
        /// <summary>
        /// Adds Distance annotation in Diagrams
        /// </summary>
        public static void AddDistanceAnnotationInDiagrams()
        {
            try
            {
                //ExStart:AddDistanceAnnotationInDiagrams
                // Create instance of annotator.
                AnnotationConfig       cfg       = CommonUtilities.GetConfiguration();
                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
                // Get input file stream
                Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite);

                // Initialize list of AnnotationInfo
                List <AnnotationInfo> annotations = new List <AnnotationInfo>();

                // Initialize distance annotation
                AnnotationInfo distanceAnnnotation = new AnnotationInfo
                {
                    Box        = new Rectangle((float)248.73202514648438, (float)287.85653686523438, (float)115.9178466796875, (float)25.143020629882812),
                    CreatedOn  = DateTime.Now,
                    Opacity    = 0.3,
                    PageNumber = 0,
                    SvgPath    = "M248.73201877934272,295.5439436619718 l115.28309859154929,-4.192112676056338",
                    Type       = AnnotationType.Distance,
                };

                // Add annotation to list
                annotations.Add(distanceAnnnotation);

                // Get output file stream
                Stream result = annotator.ExportAnnotationsToDocument(inputFile, annotations);

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.vsdx"), FileMode.Create))
                {
                    byte[] buffer = new byte[result.Length];
                    result.Seek(0, SeekOrigin.Begin);
                    result.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
                //ExEnd:AddDistanceAnnotationInDiagrams
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Esempio n. 25
0
        public ActionResult Get(string guid)
        {
            Response.AddHeader("Content-Type", "application/json");
            AnnotationImageHandler imageHandler = Utils.createAnnotationImageHandler();

            //String guid = request.getParameter("guid");

            DeleteReplyResult result = imageHandler.DeleteAnnotationReply(guid);

            return(Content(JsonConvert.SerializeObject(
                               result,
                               Formatting.Indented,
                               new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }
                               ), "application/json"));
        }
        public ActionResult Get(string file)
        {
            Response.AddHeader("Content-Type", "application/json");
            AnnotationImageHandler imageHandler = Utils.createAnnotationImageHandler();
            String filename     = file;// request.getParameter("file");
            long   annotationId = long.Parse(Request.Params["annotationId"]);

            DeleteAnnotationResult result = imageHandler.DeleteAnnotation(annotationId);

            return(Content(JsonConvert.SerializeObject(
                               result,
                               Formatting.Indented,
                               new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }
                               ), "application/json"));
        }
        /// <summary>
        /// Adds Point annotation in Diagrams
        /// </summary>
        public static void AddPointAnnotationInDiagrams()
        {
            try
            {
                //ExStart:AddPointAnnotationInDiagrams
                // Create instance of annotator.
                AnnotationConfig       cfg       = CommonUtilities.GetConfiguration();
                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
                // Get input file stream
                Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite);

                // Initialize list of AnnotationInfo
                List <AnnotationInfo> annotations = new List <AnnotationInfo>();

                // Initialize point annotation
                AnnotationInfo pointAnnnotation = new AnnotationInfo()
                {
                    Box        = new Rectangle(150.32f, 99.22f, 0, 0),
                    CreatedOn  = DateTime.Now,
                    PageNumber = 0,
                    Type       = AnnotationType.Point,
                };

                // Add annotation to list
                annotations.Add(pointAnnnotation);

                // Get output file stream
                Stream result = annotator.ExportAnnotationsToDocument(inputFile, annotations);

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.vsdx"), FileMode.Create))
                {
                    byte[] buffer = new byte[result.Length];
                    result.Seek(0, SeekOrigin.Begin);
                    result.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
                //ExEnd:AddPointAnnotationInDiagrams
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        /// <summary>
        /// Adds TextField annotation in Diagrams
        /// </summary>
        public static void AddTextFieldAnnotationInDiagrams()
        {
            try
            {
                //ExStart:AddTextFieldAnnotationInDiagrams
                // Create instance of annotator.
                AnnotationConfig       cfg       = CommonUtilities.GetConfiguration();
                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
                // Get input file stream
                Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite);

                // Initialize list of AnnotationInfo
                List <AnnotationInfo> annotations = new List <AnnotationInfo>();

                // Initialize textfield annotation
                AnnotationInfo textFieldAnnotation = new AnnotationInfo
                {
                    CreatedOn       = DateTime.Now,
                    Type            = AnnotationType.TextField,
                    Box             = new Rectangle(162.87f, 267.5f, 91.8f, 42.45f),
                    BackgroundColor = -15988609,
                    FieldText       = "Annotation Text"
                };
                // Add annotation to list
                annotations.Add(textFieldAnnotation);

                // Get output file stream
                Stream result = annotator.ExportAnnotationsToDocument(inputFile, annotations);

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.vsdx"), FileMode.Create))
                {
                    byte[] buffer = new byte[result.Length];
                    result.Seek(0, SeekOrigin.Begin);
                    result.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
                //ExEnd:AddTextFieldAnnotationInDiagrams
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
        public static Document findDocumentByName(string filename)
        {
            AnnotationImageHandler imageHandler        = Utils.createAnnotationImageHandler();
            IDocumentDataHandler   documentDataHandler = imageHandler.GetDocumentDataHandler();
            Document doc = documentDataHandler.GetDocument(filename);

            if (doc != null)
            {
                return(doc);
            }

            long documentId = imageHandler.CreateDocument(filename);

//            using (FileStream original = new FileStream(Utils.getStoragePath() + "/" + filename,FileMode.Create)) {
//                imageHandler.ImportAnnotations(original, documentId);
//            }
            return(documentDataHandler.Get(documentId));
        }
        /// <summary>
        /// Adds Polyline annotation in Diagrams
        /// </summary>
        public static void AddPolylineAnnotationInDiagrams()
        {
            try
            {
                //ExStart:AddPolylineAnnotationInDiagrams
                // Create instance of annotator.
                AnnotationConfig       cfg       = CommonUtilities.GetConfiguration();
                AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
                // Get input file stream
                Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(CommonUtilities.filePath), FileMode.Open, FileAccess.ReadWrite);

                // Initialize list of AnnotationInfo
                List <AnnotationInfo> annotations = new List <AnnotationInfo>();

                // Initialize polyline annotation
                AnnotationInfo polylineAnnotation = new AnnotationInfo
                {
                    CreatedOn = DateTime.Now,
                    Type      = AnnotationType.Polyline,
                    Box       = new Rectangle(206.3f, 106.61f, 456.04f, 307.97f),
                    SvgPath   = "M436.293427230047,148.06338028169014l0,-0.9870892018779343l-0.9870892018779343,-0.9870892018779343l-1.9741784037558685,-0.9870892018779343l-0.9870892018779343,0l-0.9870892018779343,-0.9870892018779343l-1.9741784037558685,-0.9870892018779343l-0.9870892018779343,0l-1.9741784037558685,-0.9870892018779343l-1.9741784037558685,0l-4.935446009389671,-1.9741784037558685l-1.9741784037558685,0l-1.9741784037558685,-0.9870892018779343l-1.9741784037558685,0l-1.9741784037558685,-0.9870892018779343l-2.961267605633803,0l-2.961267605633803,0l-2.961267605633803,0l-2.961267605633803,0l-2.961267605633803,0l-2.961267605633803,0l-1.9741784037558685,0l-3.948356807511737,0l-2.961267605633803,0l-3.948356807511737,0l-4.935446009389671,0l-3.948356807511737,0.9870892018779343l-4.935446009389671,0.9870892018779343l-6.90962441314554,0l-3.948356807511737,0.9870892018779343l-3.948356807511737,0l-2.961267605633803,1.9741784037558685l-3.948356807511737,0.9870892018779343l-6.90962441314554,1.9741784037558685l-6.90962441314554,0.9870892018779343l-12.832159624413146,2.961267605633803l-6.90962441314554,1.9741784037558685l-5.922535211267606,0.9870892018779343l-5.922535211267606,1.9741784037558685l-5.922535211267606,1.9741784037558685l-5.922535211267606,0.9870892018779343l-4.935446009389671,1.9741784037558685l-5.922535211267606,1.9741784037558685l-5.922535211267606,1.9741784037558685l-4.935446009389671,1.9741784037558685l-5.922535211267606,2.961267605633803l-5.922535211267606,3.948356807511737l-5.922535211267606,3.948356807511737l-4.935446009389671,3.948356807511737l-5.922535211267606,3.948356807511737l-5.922535211267606,3.948356807511737l-3.948356807511737,5.922535211267606l-        3.948356807511737,4.935446009389671l-3.948356807511737,5.922535211267606l-3.948356807511737,6.90962441314554l-3.948356807511737,7.896713615023474l-0.9870892018779343,6.90962441314554l-1.9741784037558685,7.896713615023474l-1.9741784037558685,6.90962441314554l-0.9870892018779343,7.896713615023474l0,12.832159624413146l0,7.896713615023474l0,7.896713615023474l0.9870892018779343,7.896713615023474l1.9741784037558685,5.922535211267606l2.961267605633803,5.922535211267606l0.9870892018779343,5.922535211267606l2.961267605633803,6.90962441314554l3.948356807511737,5.922535211267606l4.935446009389671,4.935446009389671l3.948356807511737,5.922535211267606l3.948356807511737,5.922535211267606l3.948356807511737,5.922535211267606l5.922535211267606,5.922535211267606l5.922535211267606,5.922535211267606l5.922535211267606,5.922535211267606l6.90962441314554,5.922535211267606l7.896713615023474,5.922535211267606l7.896713615023474,5.922535211267606l17.767605633802816,8.883802816901408l11.845070422535212,3.948356807511737l11.845070422535212,4.935446009389671l23.690140845070424,8.883802816901408l41.45774647887324,6.90962441314554l31.586854460093896,3.948356807511737l16.780516431924884,0l16.780516431924884,1.9741784037558685l16.780516431924884,0l16.780516431924884,0l16.780516431924884,0l16.780516431924884,0l16.780516431924884,-1.9741784037558685l14.806338028169014,-1.9741784037558685l14.806338028169014,-1.9741784037558685l12.832159624413146,-1.9741784037558685l10.857981220657276,-2.961267605633803l10.857981220657276,-2.961267605633803l8.883802816901408,-4.935446009389671l8.883802816901408,-4.935446009389671l6.90962441314554,-6.90962441314554l6.90962441314554,-6.90962441314554l8.883802816901408,-16.780516431924884l4.935446009389671,-7.896713615023474l3.948356807511737,-8.883802816901408l4.935446009389671,-7.896713615023474l4.935446009389671,-7.896713615023474l3.948356807511737,-13.81924882629108l1.9741784037558685,-18.754694835680752l0,-7.896713615023474l0,-12.832159624413146l-1.9741784037558685,-15.793427230046948l-1.9741784037558685,-15.793427230046948l-4.935446009389671,-15.793427230046948l-8.883802816901408,-15.793427230046948l-12.832159624413146,-23.690140845070424l-10.857981220657276,-10.857981220657276l-5.922535211267606,-3.948356807511737l-12.832159624413146,-8.883802816901408l-9.870892018779342,-8.883802816901408l-5.922535211267606,-3.948356807511737l-12.832159624413146,-5.922535211267606l-15.793427230046948,-8.883802816901408l-13.81924882629108,-4.935446009389671l-11.845070422535212,-2.961267605633803l-11.845070422535212,-3.948356807511737l-11.845070422535212,-3.948356807511737l-5.922535211267606,-1.9741784037558685l-11.845070422535212,-2.961267605633803l-11.845070422535212,-1.9741784037558685l-5.922535211267606,-0.9870892018779343l-10.857981220657276,-1.9741784037558685l-10.857981220657276,-2.961267605633803l-9.870892018779342,0l-0.9870892018779343,0l-0.9870892018779343,0l-0.9870892018779343,0l-0.9870892018779343,0l0,-0.9870892018779343l1.9741784037558685,0",
                };
                // Add annotation to list
                annotations.Add(polylineAnnotation);

                // Get output file stream
                Stream result = annotator.ExportAnnotationsToDocument(inputFile, annotations);

                // Save result stream to file.
                using (FileStream fileStream = new FileStream(CommonUtilities.MapDestinationFilePath("Annotated.vsdx"), FileMode.Create))
                {
                    byte[] buffer = new byte[result.Length];
                    result.Seek(0, SeekOrigin.Begin);
                    result.Read(buffer, 0, buffer.Length);
                    fileStream.Write(buffer, 0, buffer.Length);
                    fileStream.Close();
                }
                //ExEnd:AddPolylineAnnotationInDiagrams
            }
            catch (System.Exception exp)
            {
                Console.WriteLine(exp.Message);
            }
        }
Esempio n. 31
0
        // GET: Annotation
        public ActionResult List(string file)
        {
            Response.AddHeader("Content-Type", "application/json");
            AnnotationImageHandler handler = Utils.createAnnotationImageHandler();
            String   filename = file;
            Document doc      = Utils.findDocumentByName(filename);
            ListAnnotationsResult listResult = handler.GetAnnotations(doc.Id);

            List <GetAnnotationResult> list = new List <GetAnnotationResult>();

            foreach (AnnotationInfo inf in listResult.Annotations)
            {
                list.Add(handler.GetAnnotation(inf.Guid));
            }
            return(Content(JsonConvert.SerializeObject(
                               list,
                               Formatting.Indented,
                               new JsonSerializerSettings {
                ContractResolver = new CamelCasePropertyNamesContractResolver()
            }
                               ), "application/json"));


            //Response.Write(list);

            /*
             *
             * response.setHeader("Content-Type", "application/json");
             * AnnotationImageHandler imageHandler = Utils.createAnnotationImageHandler();
             * String filename = request.getParameter("file");
             *
             * Document doc = Utils.findDocumentByName(filename);
             * ListAnnotationsResult listResult = imageHandler.getAnnotations(doc.getId());
             *
             * ArrayList<GetAnnotationResult> list = new ArrayList<>();
             * for (AnnotationInfo inf : listResult.getAnnotations()) {
             * list.add(imageHandler.getAnnotation(inf.getGuid()));
             * }
             *
             * new ObjectMapper().writeValue(response.getOutputStream(), list);*/


            return(View());
        }
 public ViewerController(AnnotationImageHandler annotator)
 {
     this.annotator = annotator;
 }
 /// <summary>
 /// Initializes a new instance of the AnnotationService class
 /// </summary>
 /// <param name="annotationBroadcaster">The annotation Socket events broadcasting object</param>
 /// <param name="authenticationSvc">The authentication service</param>
 /// <param name="annotator">The annotation management service</param>
 public AnnotationService(IAnnotationBroadcaster annotationBroadcaster, IAuthenticationService authenticationSvc,
     AnnotationImageHandler annotator)
 {
     _annotationBroadcaster = annotationBroadcaster;
     _authenticationSvc = authenticationSvc;
     _userSvc = annotator.GetUserDataHandler();
     _annotator = annotator;
     _documentSvc = annotator.GetDocumentDataHandler();
     _fileSvc = annotator.GetInputDataHandler();
     MapperConfiguration config = new MapperConfiguration(cfg =>
     {
         cfg.CreateMap<GroupDocs.Annotation.Domain.Rectangle, Rectangle>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.ReviewerInfo, ReviewerInfo>();
         cfg.CreateMap<ReviewerInfo, GroupDocs.Annotation.Domain.ReviewerInfo>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.AnnotationReplyInfo, AnnotationReplyInfo>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.TextFieldInfo, TextFieldInfo>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.Result, Result>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Point?, Point>()
         .ForMember(dst => dst.X, opt => opt.MapFrom(src => src.HasValue ? src.Value.X : 0.0))
         .ForMember(dst => dst.Y, opt => opt.MapFrom(src => src.HasValue ? src.Value.Y : 0.0));
         cfg.CreateMap<GroupDocs.Annotation.Domain.AnnotationInfo, AnnotationInfo>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.ListAnnotationsResult, ListAnnotationsResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.SetCollaboratorsResult, SetCollaboratorsResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.CreateAnnotationResult, CreateAnnotationResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.DeleteAnnotationResult, DeleteAnnotationResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.AddReplyResult, AddReplyResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.DeleteReplyResult, DeleteReplyResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.EditReplyResult, EditReplyResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.MoveAnnotationResult, MoveAnnotationResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.ResizeAnnotationResult, ResizeAnnotationResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.SaveAnnotationTextResult, SaveAnnotationTextResult>();
         cfg.CreateMap<GroupDocs.Annotation.Domain.Results.GetCollaboratorsResult, GetCollaboratorsResult>();
     });
     _mapper = config.CreateMapper();
 }