Free Support Forum -

How to programmatically view and add annotations in a document

I am evaluating PDFtron PDFNETJS, a solution to view pdfs and add annotations, import xfdf, and more through JavaScript. How does GroupDocs compare to this?


Thank you for your inquiry. GroupDocs provides various document manipulation APIs. You can view, annotate or compare and convert documents. Please share your business needs or use-case so that we can guide you accordingly and refer you a matching API.

  1. Can I embed a PDF into the component, then outside that component in my normal JavaScript code, add annotations to the PDF? For example, I would have a button outside the component that says “Add Footers” and I would call JavaScript code to add a piece of text to the bottom of every page of the PDF. Is this possible? If so, is there a snippet example somewhere? I expect to be able to put in the page number and rectangle coordinates of where I want to place the Annotation. I don’t want any user involvement of the placement of the Annotation. I will allow them to move it around once created though.

  2. Can I import XFDF file to the PDF once loaded? Can I export just the annotations?

  3. Can I add an annotation through JavaScript, and then check to make sure it still exists at any point(that the user did not manually delete it).

  4. Can I programmatically either server or client side scan the document and highlight words when the PDF loaded?


You can render a PDF document in your project using GroupDocs.Viewer API depending on your platform (GroupDocs.Viewer comes for both .NET and Java platform). Using GroupDocs.Annotation you can annotate the rendered document as follows:

Furthermore, GroupDocs.Annotation provides a set of methods for collaborators management.

Can you please elaborate this a bit more?

You can export annotations to a document as follows:

Please see how you can add annotations (Area annotation with replies) using GroupDocs.Annotation API:
Adding Annotation Java

Yes, please explore GroupDocs.Search for this purpose. GroupDocs.Search provide the feature to search the document for specific words or phrases. You can download the showcase project from here.

Hi, some of the links you provided have no actual code samples. I am using .NET

For the XFDF import, I basically need a way to import a set of annotations. Is there a better way to do that? For example, lets say I used GroupDocs.Search to find some text, how could I take those results and then highlight the words when the PDF loads?

Could you point me to a code snippet of adding an annotation through JavaScript. Also, is there any other location I can download the samples if Github is blocked at my work?


Those were the documentation links that we shared with you.

The only way to import annotations to a document is given in this article. Furthermore, please note that GroupDocs.Annotation for .NET is a totally back-end API that is UI independent. So annotations will be added using C# code not using JavaScript. The good thing is, GroupDocs.Annotation for .NET provides documents rendering facility as well. Hence, you can use this single API and implement your use-case(s). We have developed showcase projects for your ease. Those projects are open-source, you can amend or enhance them to any extent. Please learn more about the showcase project here. This is a very basic project that elaborates core functionalities of the back-end API. The feature of loading document with highlighted search word is not provided by the back-end API. However, you can implement this feature using JavaScript after the document is rendered in showcase project.

Please download the console and showcase projects here. If you go in showcases folder, we’d recommend you to explore modern front end. Its documentation is here.

Thanks for the information.

The first article and many others have no actual code samples where it looks like there should be.

Also, google drive is blocked as well. Why is this not hosted on groupdocs website which is not blocked?

Can you explain why the GroupDocs.Annotation has a UI and also the GroupDocs.Viewer has a UI? Can I use the GroupDocs.Viewer UI and add annotations through it by enabling a flag? This is confusing.


Those are the code snippets. We can share complete project (console and showcases) with you. Please tell us, what is the most accessible medium for you where we can share the project. We only have GitHub repositories so far.
Coming to your second question, both (GroupDocs.Annotation for .NET and GroupDocs.Viewer for .NET) APIs are basically UI independent. They are back-end APIs so that user can integrate them in any .NET project.That is why we developed some UI projects for developers ease. So that they can examine how API works at UI level.
Its better if you use GroupDocs.Annotation for .NET, because it gives both documents rendering and annotation facility. You can render a document and add different annotations supported by the API.

The best place to download from is your website. Can you create an amazon s3 link from your site?

I have downloaded GroupDocs.Viewer but don’t see an example of how I can call a backend API to add an annotation and have it refresh what the user is seeing.

Furthermore, I have figured out why none of your code samples show up for me at work. Because your code samples are hosted through github, all I see is blank pages and see no code snippets.


Sorry but we only host our example projects on GitHub. However, if you tell us about any medium that is accessible for you (Dropbox, WeTransfer, SkyDrive, MediaFire, RapidShare), we can share project there.