Document annotation API sample project in .NET

Hello,
I’m trying running GroupDocs.Annotation.Examples.CSharp.
when running I get an error message displayed,

image.png (32.4 KB)

can you help me, please

@softwareadmin,

Thanks for your inquiry. Can you please tell which version of the API you integrated in the example project? Also, please share sample project and problematic file with us.

hi sami,
i’m using the API 17.4.0.0
and the sample project is from git hub.

@Nayla,

We are not able to reproduce this issue at our end using the GitHub project with 17.4.0 version of the API. Meanwhile, looking your error in details, we observed that this is not a back-end API issue, one of the possible reasons of this error is that the Visual Studio locks the file and prevents itself from deleting the file so that it can recreate it when you rebuild the application. There are few ways to overcome this issue:

  • Close and restart VS so that it will release the lock on the file.
  • Build > Clean Solution
  • Build > Rebuild Solution
  • Disable parallel build - went into Tools > Options > Projects and Solutions > Build and Run > “maximum numbers of parallel project builds” - by default it has value of 8, change it to 1.

Aside this, your document (annotated.pdf) can be locked by some other process. You need to release the document from that process in order to annotate it.

@sami.cheema
thank’s for your attention,
I have followed your instruction,
but still get message displayed,
groupdocsIssue.PNG (93.6 KB)

@Nayla,

In order to further investigate the issues, we need following details form you:

  1. Share the problematic file
  2. If you did any changes in the code, please share those changes

We’d appreciate your cooperation.

@sami.cheema

I have changed Program.cs file.
Program.zip (1.4 KB)
when runnning the example project, the message show up.

@Nayla,

We are able to reproduce this issue at our end. It happens because all the methods/processes are using same input file and you are calling all the methods simultaneously. So, when a process tries to annotate the file which is not released by the first process yet, you face that issue/exception. As a work-around, please try to execute all processes one by one (comment other method/process calls). Let us know if it helps.

@sami.cheema

thank’s sami for your effort,
one problem has solved.
i have one remaining problem about document permission,
when runnning the example project, the message show
image.png (45.9 KB)

@Nayla,

Can you please share the problematic file with us? Also, share name of the method you are using to add annotation. We’ll investigate that at our end and let you know about the outcomes.

@sami.cheema
i’m using the same file in the previous post reply.
Program.cs.zip (1.4 KB)

@Nayla,

This error is thrown by the method ManageCollaboratorRights. In this method reviewer is created with only view rights and later that reviewer tries to add annotation. So, that’s why you are getting this error. To overcome this issue, you can create reviewer with the permission of CanAnnotate or update the collaborator before adding annotation as follow:

reviewerInfo.AccessRights = AnnotationReviewerRights.CanAnnotate;
var updateCollaboratorResult = annotator.UpdateCollaborator(documentId, reviewerInfo);

@sami.cheema,

I have updated the colaborator before adding annotation as follow :
reviewerInfo.AccessRights = AnnotationReviewerRights.CanAnnotate;
var updateCollaboratorResult = annotator.UpdateCollaborator(documentId, reviewerInfo);

while i’m running again the example project, i face other message as you can see below
image.png (54.0 KB)

DataStorage.cs.zip (3.4 KB)
Program.cs.zip (1.4 KB)

@Nayla,

We observed that you have updated reviewer rights in only UpdateCollaborator method but the error was generated in ManageCollaboratorRights, please update reviewer rights in this method as well. Also, comment below code line under #region Annotation Functions for Slides in Program.cs class in order to avoid Cannot open pdf file error

CommonUtilities.filePath = "sample.pptx";

With above changes we are unable to reproduce these issues at our end. Moreover, we will recommend you to evaluate examples one by one and for your ease, we do have documentation for developer. Please go through the wiki and let us know if your issues are resolved.

@sami.cheema

thank’s sami.

now, I have the license of GroupDocs.Total.
and then, would should I do to start create my own website for annotation or other function of my document that have stored in other server?
do you have step by step for do that?

We’d appreciate your help

@Nayla,

We have already developed some showcase projects for your ease here which demonstrates basic functionalities of the API. As these showcase projects are open-source, you can also add new features in them. Furthermore, the GroupDocs.Annotation for .NET is totally back-end, UI and framework Independent API. So, you can use this API to develop your own front end project as well.

thank you so much @sami.cheema

@Nayla,

You are welcome.