public ActionResult Sample42()
        {
            // Check is data posted
            if (Request.HttpMethod == "POST")
            {
                //### Set variables and get POST data
                System.Collections.Hashtable result = new System.Collections.Hashtable();
                String clientId = Request.Form["clientId"];
                String privateKey = Request.Form["privateKey"];
                String fileId = Request.Form["fileId"];
                String basePath = Request.Form["basePath"];
                String guid = "";
                String message = null;
                String iframe = "";
                String name = "";
                if (clientId == null || privateKey == null)
                {
                    // If not all fields entered send error message
                    message = "Please enter all parameters";
                    result.Add("error", message);
                    return View("Sample42", null, result);
                }
                else
                {
                    if (basePath == "")
                    {
                        basePath = "https://api.groupdocs.com/v2.0";
                    }
                    //Add data to template
                    result.Add("basePath", basePath);
                    result.Add("clientId", clientId);
                    result.Add("privateKey", privateKey);
                    result.Add("fileId", fileId);

                    // Create service for Groupdocs account
                    GroupdocsService service = new GroupdocsService(basePath, clientId, privateKey);
                    //Create list with URL's
                    Groupdocs.Api.Contract.Annotation.ListAnnotationsResult allAnnotations = service.ListAnnotations(fileId);
                    if (allAnnotations.Annotations.Length != 0)
                    {
                        Random rand = new Random();
                        //Create job which will get document with annotations
                        Groupdocs.Api.Contract.CreateJobResult createJob = service.CreateJob(Groupdocs.Common.JobActions.ImportAnnotations, null, false, false, "test" + rand.Next());
                        if (!createJob.JobGuid.Equals(""))
                        {
                            //Add document with annotations to new job
                            Boolean addJobDocument = service.AddJobDocument(createJob.JobGuid, fileId, "pdf", false);
                            if (addJobDocument.Equals(false))
                            {
                                message = "Add document to job is failed";
                                result.Add("error", message);
                                return View("Sample42", null, result);
                            }
                            else
                            {
                                //Run job
                                Boolean schedule = service.ScheduleJob(createJob.JobId);
                                System.Threading.Thread.Sleep(5000);
                                //Get documents from job
                                int counter = 5;
                                for (int i = 0; i < counter; i++)
                                {
                                    Groupdocs.Api.Contract.GetJobDocumentsResult getDocument = service.GetJobDocuments(createJob.JobId);
                                    if (!getDocument.JobStatus.ToString().Equals("Archived"))
                                    {
                                        System.Threading.Thread.Sleep(5000);
                                    }
                                    else
                                    {
                                        guid = getDocument.Inputs[0].Outputs[0].Guid;
                                        name = getDocument.Inputs[0].Outputs[0].Name;
                                        break;
                                    }
                                }
                                if (String.IsNullOrEmpty(guid))
                                {
                                    message = "Get document from job is failed or job is Draft";
                                    result.Add("error", message);
                                    return View("Sample42", null, result);
                                }
                                else
                                {
                                    // Generate Embed Annotation url with entered file id
                                    if (basePath.Equals("https://api.groupdocs.com/v2.0"))
                                    {
                                        iframe = "https://apps.groupdocs.com/document-annotation/embed/" + guid;
                                    }
                                    if (basePath.Equals("https://dev-api-groupdocs.dynabic.com/v2.0"))
                                    {
                                        iframe = "https://dev-apps-groupdocs.dynabic.com/document-annotation/embed/" + guid;
                                    }
                                    if (basePath.Equals("https://stage-api-groupdocs.dynabic.com/v2.0"))
                                    {
                                        iframe = "https://stage-apps-groupdocs.dynabic.com/document-annotation/embed/" + guid;
                                    }
                                    if (basePath.Equals("https://realtime-api-groupdocs.dynabic.com/v2.0"))
                                    {
                                        iframe = "https://realtime-apps-groupdocs.dynabic.com/document-annotation/embed/" + guid;
                                    }
                                    iframe = Groupdocs.Security.UrlSignature.Sign(iframe, privateKey);
                                    result.Add("iframe", iframe);
                                    // Definition of folder where to download file
                                    String downloadFolder = AppDomain.CurrentDomain.BaseDirectory + "downloads/";

                                    if (!Directory.Exists(downloadFolder))
                                    {
                                        DirectoryInfo di = Directory.CreateDirectory(downloadFolder);
                                    }

                                    //### Make a request to Storage Api for dowloading file
                                    // Download file
                                    bool file = service.DownloadFile(guid, downloadFolder + name);
                                    message = "File with annotations was downloaded to server's local folder. You can download it from ";
                                    result.Add("message", message);
                                    result.Add("name", name);
                                    return View("Sample42", null, result);
                                }
                            }
                        }
                        else
                        {
                            message = "Create job is failed";
                            result.Add("error", message);
                            return View("Sample42", null, result);
                        }
                    }
                    else
                    {
                        message = "Get all anotations is failed";
                        result.Add("error", message);
                        return View("Sample42", null, result);
                    }
                }
            }
            // If data not posted return to template for filling of necessary fields
            else
            {
                return View("Sample42");
            }
        }
        public ActionResult Sample43()
        {
            // Check is data posted
            if (Request.HttpMethod == "POST")
            {
                //### Set variables and get POST data
                System.Collections.Hashtable result = new System.Collections.Hashtable();
                String clientId = Request.Form["clientId"];
                String privateKey = Request.Form["privateKey"];
                String fileId = Request.Form["fileId"];
                String url = Request.Form["url"];
                var file = Request.Files["file"];
                String guid = "";
                String basePath = Request.Form["basePath"];
                // Set entered data to the results list
                result.Add("clientId", clientId);
                result.Add("privateKey", privateKey);
                result.Add("basePath", basePath);
                String message = null;
                String iframe = "";
                // Check is all needed fields are entered
                if (clientId == null || privateKey == null)
                {
                    // If not all fields entered send error message
                    message = "Please enter all parameters";
                    result.Add("error", message);
                    return View("Sample43", null, result);
                }
                else
                {

                    if (basePath.Equals(""))
                    {
                        basePath = "https://api.groupdocs.com/v2.0";
                    }
                    // Create service for Groupdocs account
                    GroupdocsService service = new GroupdocsService(basePath, clientId, privateKey);

                    //if URL to web file was provided - upload the file from Web and get it's GUID
                    if (!url.Equals(""))
                    {

                        //Make request to upload file from entered Url
                        String uploadWeb = service.UploadUrl(url);
                        if (uploadWeb != null)
                        {
                            //If file uploaded return his GuId
                            guid = uploadWeb;

                        }
                        //If file wasn't uploaded return error
                        else
                        {
                            result.Add("error", "Something wrong with entered data");
                            return View("Sample43", null, result);
                        }

                    }
                    //if file was uploaded locally - upload the file and get it's GUID
                    if (!file.FileName.Equals(""))
                    {

                        //Upload local file
                        Groupdocs.Api.Contract.UploadRequestResult upload = service.UploadFile(file.FileName, String.Empty, file.InputStream);
                        if (upload.Guid != null)
                        {
                            //If file uploaded return his guid
                            guid = upload.Guid;

                        }
                        else
                        {
                            //If file wasn't uploaded return error
                            result.Add("error", "Something wrong with entered data");
                            return View("Sample43", null, result);
                        }

                    }
                    if (fileId != null)
                    {
                        guid = fileId;

                    }
                    //Create list of file types for converting
                    System.Collections.Generic.List<Groupdocs.Common.FileType> fileType = new System.Collections.Generic.List<Groupdocs.Common.FileType>();
                    //Add PDF to list of file types
                    fileType.Add(Groupdocs.Common.FileType.Doc);
                    Random rand = new Random();
                    //Create job which will add line numeration to the document
                    Groupdocs.Api.Contract.CreateJobResult createJob = service.CreateJob(Groupdocs.Common.JobActions.NumberLines | Groupdocs.Common.JobActions.Convert, fileType.ToArray(), false, false, "test" + rand.Next());
                    if (!createJob.JobGuid.Equals(""))
                    {

                        //Add document to the new job
                        Boolean addJobDocument = service.AddJobDocument(createJob.JobGuid, guid, "", false);
                        if (addJobDocument.Equals(false))
                        {
                            message = "Add document to job is failed";
                            result.Add("error", message);
                            return View("Sample43", null, result);
                        }
                        else
                        {

                            //Run job
                            Boolean schedule = service.ScheduleJob(createJob.JobId);
                            System.Threading.Thread.Sleep(5000);
                            //Get documents from job
                            int counter = 5;
                            for (int i = 0; i < counter; i++)
                            {
                                Groupdocs.Api.Contract.GetJobDocumentsResult getDocument = service.GetJobDocuments(createJob.JobId);
                                if (!getDocument.JobStatus.ToString().Equals("Archived"))
                                {
                                    System.Threading.Thread.Sleep(5000);
                                }
                                else
                                {
                                    guid = getDocument.Inputs[0].Outputs[0].Guid;
                                    break;
                                }
                            }
                            if (String.IsNullOrEmpty(guid))
                            {
                                message = "Get document from job is failed or job is Draft";
                                result.Add("error", message);
                                return View("Sample43", null, result);
                            }
                            else
                            {
                                // Generate Embed viewer url with entered file id
                                if (basePath.Equals("https://api.groupdocs.com/v2.0"))
                                {
                                    iframe = "https://apps.groupdocs.com/document-viewer/embed/" + guid;
                                }
                                if (basePath.Equals("https://dev-api-groupdocs.dynabic.com/v2.0"))
                                {
                                    iframe = "https://dev-apps-groupdocs.dynabic.com/document-viewer/embed/" + guid;
                                }
                                if (basePath.Equals("https://stage-api-groupdocs.dynabic.com/v2.0"))
                                {
                                    iframe = "https://stage-apps-groupdocs.dynabic.com/document-viewer/embed/" + guid;
                                }
                                if (basePath.Equals("https://realtime-api-groupdocs.dynabic.com/v2.0"))
                                {
                                    iframe = "https://realtime-apps-groupdocs.dynabic.com/document-viewer/embed/" + guid;
                                }
                                iframe = Groupdocs.Security.UrlSignature.Sign(iframe, privateKey);
                                result.Add("iframe", iframe);
                                result.Add("fileId", guid);
                                return View("Sample43", null, result);
                            }
                        }
                    }
                    else
                    {
                        result.Add("error", "Create job is failed");
                        return View("Sample43", null, result);
                    }
                }
            }
            // If data not posted return to template for filling of necessary fields
            else
            {
                return View("Sample43");
            }
        }
        public ActionResult Sample33()
        {
            // Check is data posted
            if (Request.HttpMethod == "POST")
            {
                //### Set variables and get POST data
                System.Collections.Hashtable result = new System.Collections.Hashtable();
                String clientId = Request.Form["clientId"];
                String privateKey = Request.Form["privateKey"];
                String url1 = Request.Form["url1"];
                String url2 = Request.Form["url3"];
                String url3 = Request.Form["url3"];
                String basePath = Request.Form["basePath"];
                String guid = "";
                String message = null;
                String iframe = "";
                if (clientId == null || privateKey == null)
                {
                    // If not all fields entered send error message
                    message = "Please enter all parameters";
                    result.Add("error", message);
                    return View("Sample33", null, result);
                }
                else
                {
                    if (basePath == "")
                    {
                        basePath = "https://api.groupdocs.com/v2.0";
                    }
                    //Add data to template
                    result.Add("basePath", basePath);
                    result.Add("clientId", clientId);
                    result.Add("privateKey", privateKey);
                    result.Add("url1", url1);
                    result.Add("url2", url2);
                    result.Add("url3", url3);
                    // Create service for Groupdocs account
                    GroupdocsService service = new GroupdocsService(basePath, clientId, privateKey);
                    //Create list with URL's
                    System.Collections.Generic.List<String> urlList = new System.Collections.Generic.List<String>();
                    //Put URL's to list
                    urlList.Add(url1);
                    urlList.Add(url2);
                    urlList.Add(url3);
                    //Create empty list for guid's of uploaded files
                    System.Collections.Generic.List<String> guidsList = new System.Collections.Generic.List<String>();
                    //Loop for upload document from URL
                    for (int i = 0; i < urlList.Count; i++)
                    {
                        String uploadedGuid = service.UploadUrl(urlList[i]);
                        if (uploadedGuid != null)
                        {
                            //Put uploaded file GUID to list
                            guidsList.Add(uploadedGuid);
                        }
                        else
                        {
                            message = "Upload is failed";
                            result.Add("error", message);
                            return View("Sample33", null, result);
                        }
                    }
                    //Create list of file types for converting
                    System.Collections.Generic.List<Groupdocs.Common.FileType> fileType = new System.Collections.Generic.List<Groupdocs.Common.FileType>();
                    //Add PDF to list of file types
                    fileType.Add(Groupdocs.Common.FileType.Pdf);
                    System.Random rand = new System.Random();
                    //Create job.
                    //First job action is Convert
                    Groupdocs.Api.Contract.CreateJobResult createJob = service.CreateJob(Groupdocs.Common.JobActions.Combine | Groupdocs.Common.JobActions.Convert, fileType.ToArray(), false, false, "test" + rand.Next());
                    if (!createJob.JobGuid.Equals(""))
                    {
                        //Add uploaded documents to job
                        for (int n = 0; n < guidsList.Count; n++)
                        {
                            Boolean addJobDocument = service.AddJobDocument(createJob.JobGuid, guidsList[n], "", false);
                            if (addJobDocument.Equals(false))
                            {
                                message = "Add document to job is failed";
                                result.Add("error", message);
                                return View("Sample33", null, result);
                            }
                        }
                        //Get job for update
                        Groupdocs.Api.Contract.JobInfo jobInfo = new Groupdocs.Api.Contract.JobInfo();
                        //Update job parameters and action from Convert to Combine
                        jobInfo.EmailResults = true;
                        jobInfo.Status = Groupdocs.Common.JobStatus.Pending;
                        jobInfo.Id = createJob.JobId;
                        jobInfo.Guid = createJob.JobGuid;
                        //Update job
                        Boolean updateJob = service.UpdateJob(jobInfo);
                        if (updateJob.Equals(true))
                        {
                            System.Threading.Thread.Sleep(5000);
                            //Get documents from job
                            Groupdocs.Api.Contract.GetJobDocumentsResult getDocument = service.GetJobDocuments(createJob.JobGuid);
                            if (String.IsNullOrEmpty(getDocument.Outputs[0].Guid))
                            {
                                message = "Get document from job is failed or job is Draft";
                                result.Add("error", message);
                                return View("Sample33", null, result);
                            }
                            else
                            {
                                guid = getDocument.Outputs[0].Guid;
                                // Generate Embed viewer url with entered file id
                                if (basePath.Equals("https://api.groupdocs.com/v2.0"))
                                {
                                    iframe = "https://apps.groupdocs.com/document-viewer/embed/" + guid;
                                }
                                if (basePath.Equals("https://dev-api-groupdocs.dynabic.com/v2.0"))
                                {
                                    iframe = "https://dev-apps-groupdocs.dynabic.com/document-viewer/embed/" + guid;
                                }
                                if (basePath.Equals("https://stage-api-groupdocs.dynabic.com/v2.0"))
                                {
                                    iframe = "https://stage-api-groupdocs.dynabic.com/document-viewer/embed/" + guid;
                                }
                                if (basePath.Equals("https://realtime-api.groupdocs.com/v2.0"))
                                {
                                    iframe = "https://realtime-apps.groupdocs.com/document-viewer/embed/" + guid;
                                }
                                iframe = Groupdocs.Security.UrlSignature.Sign(iframe, privateKey);
                                result.Add("iframe", iframe);
                                result.Add("guid", guid);
                                return View("Sample33", null, result);

                            }
                        }
                        else
                        {
                            message = "Update job is failed";
                            result.Add("error", message);
                            return View("Sample33", null, result);
                        }
                    }
                    else
                    {
                        message = "Create job is failed";
                        result.Add("error", message);
                        return View("Sample33", null, result);
                    }
                }
            }
            // If data not posted return to template for filling of necessary fields
            else
            {
                return View("Sample33");
            }
        }