public AnnotationScripts()
        {
            var pathFinder = new ApplicationPathFinder();

            _appPath = pathFinder.GetApplicationPath() + "_layouts/15/GroupDocs_Annotation_SharePoint_WebPart/";

            _scriptTemplate = string.Format("<script type='text/javascript' src='{0}{1}Scripts/{{1}}'></script>",
                                            _appPath, _urlPrefix);

            _stylesheetTemplate = string.Format("<link rel='stylesheet' type='text/css' href='{0}{1}CSS/{{1}}' />",
                                                _appPath, _urlPrefix);
        }
        public static ViewDocumentResponse ViewDocument(string path)
        {
            string request = path;

            try
            {
                GroupDocs.Annotation.License lic = new GroupDocs.Annotation.License();
                lic.SetLicense("C:/Users/Ali Ahmad/Documents/GroupDocs.Total.lic");
            }
            catch (Exception ex)
            {
                throw;
            }


            string fileName             = Path.GetFileName(request);
            var    pathFinder           = new ApplicationPathFinder();
            string _appPath             = HttpContext.Current.Server.MapPath("~/_layouts/15/GroupDocs_Annotation_SharePoint_WebPart/");
            ViewDocumentResponse result = new ViewDocumentResponse
            {
                pageCss        = new string[] { },
                lic            = true,
                pdfDownloadUrl = _appPath + "App_Data/" + request,
                url            = _appPath + "App_Data/" + request,
                path           = request,
                name           = fileName
            };
            DocumentInfoContainer docInfo = null;

            try
            {
                docInfo = annotator.GetDocumentInfo(request);
            }
            catch (Exception ex)
            {
                throw;
            }

            result.documentDescription = new FileDataJsonSerializer(docInfo.Pages).Serialize(true);
            result.docType             = docInfo.DocumentType;
            result.fileType            = docInfo.FileType;

            List <PageImage> imagePages = annotator.GetPages(request);

            // Provide images urls
            List <string> urls = new List <string>();

            // If no cache - save images to temp folder
            string tempFolderPath = HttpContext.Current.Server.MapPath("~/_layouts/15/GroupDocs_Annotation_SharePoint_WebPart/Content/TempStorage");


            foreach (PageImage pageImage in imagePages)
            {
                string docFoldePath = Path.Combine(tempFolderPath, request);

                if (!Directory.Exists(docFoldePath))
                {
                    Directory.CreateDirectory(docFoldePath);
                }

                string pageImageName = string.Format("{0}\\{1}.png", docFoldePath, pageImage.PageNumber);

                using (Stream stream = pageImage.Stream)
                    using (FileStream fileStream = new FileStream(pageImageName, FileMode.Create))
                    {
                        stream.Seek(0, SeekOrigin.Begin);
                        stream.CopyTo(fileStream);
                    }
                string baseUrl = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Request.ApplicationPath + "_layouts/15/GroupDocs_Annotation_SharePoint_WebPart/";
                urls.Add(string.Format("{0}Content/TempStorage/{1}/{2}.png", baseUrl, request, pageImage.PageNumber));
            }

            result.imageUrls = urls.ToArray();

            // invoke event
            new DocumentOpenSubscriber().HandleEvent(request, _annotationSvc);

            return(result);
        }