groupdocs-annotation / GroupDocs.Annotation-for-.NET-MVC

Moved to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET/tree/master/Demos/MVC
https://products.groupdocs.com/annotation/net
MIT License
3 stars 0 forks source link

The process cannot access the file because it is being used by another process #67

Open atirtahirgroupdocs opened 3 years ago

atirtahirgroupdocs commented 3 years ago

This issue is raised in https://forum.groupdocs.com/t/consistently-facing-issue-the-process-cannot-access-the-file-because-it-is-being-used-by-another-process-in-asp-net-mvc/9574. Hi, When a file is uploaded, edited and save button is pressed, application gives an exception. Please have a look at the following screenshots. image

image (1)

Below is the sample code:

[HttpPost]
        [Route("annotate")]
        public HttpResponseMessage AnnotateAsync(AnnotationPostedDataEntity annotateDocumentRequest)
        {
            AnnotatedDocumentEntity annotatedDocument = new AnnotatedDocumentEntity();
            try
            {
                // get/set parameters
                string documentGuid = annotateDocumentRequest.guid;
                string password = annotateDocumentRequest.password;
                string documentType = SupportedImageFormats.Contains(Path.GetExtension(annotateDocumentRequest.guid)) ? "image" : annotateDocumentRequest.documentType;
                string tempPath = GetTempPath(documentGuid);

                AnnotationDataEntity[] annotationsData = annotateDocumentRequest.annotationsData;
                // initiate list of annotations to add
                List<AnnotationBase> annotations = new List<AnnotationBase>();

                using (GroupDocs.Annotation.Annotator annotator = new GroupDocs.Annotation.Annotator(documentGuid, GetLoadOptions(password)))
                {
                    IDocumentInfo info = annotator.Document.GetDocumentInfo();

                    for (int i = 0; i < annotationsData.Length; i++)
                    {
                        AnnotationDataEntity annotationData = annotationsData[i];
                        PageInfo pageInfo = info.PagesInfo[annotationsData[i].pageNumber - 1];
                        // add annotation, if current annotation type isn't supported by the current document type it will be ignored
                        try
                        {
                            BaseAnnotator baseAnnotator = AnnotatorFactory.createAnnotator(annotationData, pageInfo);
                            if (baseAnnotator.IsSupported(documentType))
                            {
                                annotations.Add(baseAnnotator.GetAnnotationBase(documentType));
                            }
                        }
                        catch (Exception ex)
                        {
                            throw new GroupDocs.Annotation.Exceptions.AnnotatorException(ex.Message, ex);
                        }
                    }
                }

                // Add annotation to the document
                RemoveAnnotations(documentGuid, password);
                // check if annotations array contains at least one annotation to add
                if (annotations.Count != 0)
                {
                    using (GroupDocs.Annotation.Annotator annotator = new GroupDocs.Annotation.Annotator(documentGuid, GetLoadOptions(password)))
                    {
                        foreach (var annotation in annotations)
                        {
                            annotator.Add(annotation);
                        }
                        annotator.Save(tempPath);
                    }

                    if (File.Exists(documentGuid))
                    {
                        File.Delete(documentGuid);
                    }

                    File.Move(tempPath, documentGuid);

                }

                annotatedDocument = new AnnotatedDocumentEntity();
                annotatedDocument.guid = documentGuid;
                annotatedDocument.fileByte = File.ReadAllBytes(documentGuid);
                if (annotateDocumentRequest.print)
                {
                    annotatedDocument.pages = GetAnnotatedPagesForPrint(password, documentGuid);
                    File.Move(documentGuid, annotateDocumentRequest.guid);
                }
            }
            catch (Exception ex)
            {
                // set exception message
                return Request.CreateResponse(HttpStatusCode.InternalServerError, new Ultrabot.Web.UI.Annotation.Common.Resources.Resources().GenerateException(ex));
            }

            return Request.CreateResponse(HttpStatusCode.OK, annotatedDocument);
        }
kegor commented 3 years ago

Hi @atirtahirgroupdocs, we can't reproduce such issue using our .jpg file on sample app version from the master branch. So could you please add information about annotation type that was adding by the user and attach .jpg-file on which issue was met.

ImSMRizwan commented 3 years ago

Dear @kegor, but I am facing an issue Kindly Check the video:

=> https://youtu.be/UnEKwhrDM1w

kegor commented 3 years ago

Hi @ImSMRizwan, I tried to reproduce the problem using, I guess, one of yours images, and mentioned in video annotations types, but still I didn't met the issue (please take a look at the gif-animation).

I would like to mention that my manual test was made on master-branch of the current sample app (https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET-MVC).

I'll suggest you to try reproduce same steps on sample app build from re-cloned repository or from master-branch code downloaded as zip-archive.

ImSMRizwan commented 3 years ago

Dear @kegor , Thanks for your valuable comment. The save button is working fine. Now, I find another bug, kindly check the gif animation gif-notsaved

After save I download the image file but it's not showing my editing on the downloaded image. kindly check it also. I am waiting for your response. it would be best for me if you reply soon.

best regards

kegor commented 3 years ago

Hi @ImSMRizwan.

Thank you for your request. We work on your issue and when it will be fixed we will notify you here.

kegor commented 3 years ago

Hi @ImSMRizwan,

The issue has been resolved. Please checkout latest commit from master branch GroupDocs.Annotation-for-.NET-MVC.

Best Regard Egor.

ImSMRizwan commented 3 years ago

Dear @kegor, I found 2 more issues, kindly check the video => https://youtu.be/UJZS_Cd1_AQ

first, some of the annotation options are not saved (.pdf), and the second is a 14-pages pdf file are not loaded, kindly check it also,

best regards Muhammad rizwan

kmehmoodkhan commented 3 years ago

Dear support, any timeline on these issues. We are interested in purchasing this tool, can you please let us know the timelines?

kmehmoodkhan commented 3 years ago

Any tentative timeline? because we have to make a decision on the tool selection, your reply will help us finalize our decision. Thanks

bobkovalex commented 3 years ago

Hi @kmehmoodkhan

In order for us to provide any ETA we need to investigate the issue. We're already working on it. So we will get back to you ASAP.

Thanks.

Regards, Alex

kegor commented 3 years ago

Hi @ImSMRizwan,

I tried to reproduce the problem using our multi-page PDF-file and all available now annotations types and I downloaded resulted file with all annotations applied (please take a look at these gif-animations: adding and viewing).

If you still facing with the issue could you please share your PDF-file and reproducing steps.

Thank you, Egor.

kmehmoodkhan commented 3 years ago

Hi @kegor, thanks for the reply. Everything works, in the same way, the way you have shown in the video but after completing these steps when we save the annotated pdf, some of the annotations are lost as @ImSMRizwan mentioned. Can you please try to save the document on a local drive or any other storage like google drive etc and then see whether all the annotations are still there or disappear? thanks

ImSMRizwan commented 3 years ago

Dear @kegor, I am still facing issues.

Kindly find the attachment files. 6th,sci,MS.pdf Muhammad-Rizwan.pdf

Issue #1: https://drive.google.com/file/d/1c5TxrIH7cTr6Yu-AoiDjLzmNSOzQebyq/view?usp=sharing Issue #2: https://drive.google.com/file/d/1htrdtqCSJfcpoEBmmIBMH9JNKTIYtFiy/view?usp=sharing

sample app this one: https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET-MVC

bobkovalex commented 3 years ago

Hi @kmehmoodkhan @ImSMRizwan

We've released an improvement which should fix document not opening issue, please checkout latest commit from master branch.

As for not all annotations are saved/exported we are working on the fix and will release it soon (ASAP).

Thanks.

Regards, Alex

bobkovalex commented 3 years ago

@kmehmoodkhan @ImSMRizwan

We've released another improvement which should fix an issue with missing annotations. Please note that Google Drive preview might now support all annotation types, instead open document locally using Adobe or other similar application.

Make sure to:

  1. Checkout latest commit from master branch;
  2. Apply license before running GroupDocs.Annotation-for-.NET-MVC; In case if you do not have license yet, you can request a temporary licence from here.

Regards, Alex

ImSMRizwan commented 3 years ago

@bobkovalex

I have checked, But still facing missing some annotations options. kindly check the GIF below:

missingannotation_gif(1)

@kmehmoodkhan FYI

bobkovalex commented 3 years ago

@ImSMRizwan

Please check annotated document locally using Adobe Reader instead of Chrome built-in PDF viewer.

Regards, Alex

ImSMRizwan commented 3 years ago

@bobkovalex Thanks for your comment. let me check.

ImSMRizwan commented 3 years ago

@bobkovalex Thanks for your support, above mentioned issues are fixed and working fine, But Now I am facing another issue, I want to share the issue, Kindly check the GIF file below.

adjustmentissuegif

Actually, When I saved the image file the annotation position is changed. Kindly check all annotations position on image/pdf also.

@kmehmoodkhan FYI

Thanks, best regards

ImSMRizwan commented 3 years ago

@bobkovalex @kegor, any updates

ImSMRizwan commented 3 years ago

@bobkovalex and @kegor, I have found another glitch kindly check the GIF file below and also png file attached. kindly find the attachment.

PNG File:

22

GIF File:

formateerror_gif

ImSMRizwan commented 3 years ago

@bobkovalex Any update?

@bobkovalex Thanks for your support, above mentioned issues are fixed and working fine, But Now I am facing another issue, I want to share the issue, Kindly check the GIF file below.

adjustmentissuegif

Actually, When I saved the image file the annotation position is changed. Kindly check all annotations position on image/pdf also.

@kmehmoodkhan FYI

Thanks, best regards

kegor commented 3 years ago

Hi @ImSMRizwan,

The issue on save action mentioned in following comment has been resolved. Please checkout latest commit from master branch GroupDocs.Annotation-for-.NET-MVC.

The issue with positions of annotations added on image-files mentioned in following comment is under investigation.

Thank you, Egor.

ImSMRizwan commented 3 years ago

Hi @ImSMRizwan,

The issue on save action mentioned in following comment has been resolved. Please checkout latest commit from master branch GroupDocs.Annotation-for-.NET-MVC.

The issue with positions of annotations added on image-files mentioned in following comment is under investigation.

Thank you, Egor.

Ok sure, kindly check also pdf file, and also check The point annotation on a pdf file,

ImSMRizwan commented 3 years ago

@bobkovalex and @kegor, any update?

kegor commented 3 years ago

Hi @ImSMRizwan,

The issue with positions of annotations added on image-files mentioned in following comment has been partially resolved. Please checkout latest commit from master branch GroupDocs.Annotation-for-.NET-MVC.

However, there are still two issues with annotations length and text underline annotation position. We expect that they will be fixed in the next library version.

Thank you, Egor.