Free Support Forum - groupdocs.com

Annotations FileDeletion


#1

Hello,


My company is going to buy the Annotations product from Group Docs, I am doing some tests of it right now on our internal environment, using an evaluation version.

We developed the annotations project on a separate project (because of licensing) and we plan that our main app call this project through a viewer/URL on an Iframe.

The thing is that these files are stored in a folder like C:/Store/Document.pdf So I make a stream of this file and pass it to the annotation API, the API creates the temp folder, and what not with it.

Then after viewing the file I can delete it, change some “indexed” data and much more, but whenever I delete the file I get an error because the IIS (W3WP.exe Process) for the “annotations site” has the file still held on its process and I get the following error

The process cannot access the file ‘Document.PDF’ because it is being used by another process.


Can I have some help on this please, I wonder if there is an issue on my side, I wonder if I have to do a copy of the stream and send it to the API and then close it, or I dunno if there is a way to explicitly tell the viewer to close it after some time.





#2

Hello I found a solution for my error, What I did was wrap the HTML code of the annotation with an using directive.


<%
using (FileStream fs = new FileStream(ViewBag.filePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{ %>
<%=
Html.Groupdocs().Annotation()
.ElementId(“divViewer”)
.ShowFileExplorer(false)
.ZoomToFitWidth(true)
.ZoomToFitHeight(true)
.EnableTextSelection(true)
.AccessRights(Groupdocs.Common.AnnotationReviewerRights.All)
.Stream(fs, ViewBag.filename)
%>
<%} %>

#3

Hi ,

We are Glad to know that your issue is resolved. Thank you for updating us.

If you will need any help or you will have any other questions please feel free to ask.

Warm Regards