Blog

Find out about the latest from Cloudmersive.

API Spotlight: PDF Annotation APIs
4/6/2023 - Brian O'Neill


It’s no exaggeration to call PDF one of the most popular file types in the entire world. According to recent studies, it’s the third most common format found anywhere on the web – even ahead of JPG and PNG, which collectively store most of the internet’s image content.

A subtle advantage of storing content in PDF format is the option to programmatically edit that content while it remains locked in its compressed form. Manipulating files without opening them can drastically impact the efficiency of any file sharing workflow, especially when relatively small changes – such as the addition/removal of comments or annotations in a document – are required. For developers and administrators working in industries where contracts, waivers, insurance forms, mockups, etc. are being moved from one storage instance to another in large quantities, programmatically handling document annotations in large batches efficiently consolidates precious time and resources.

Our PDF Annotation APIs make it extremely easy to get, change, and remove annotations and comments from PDF documents without ever having to open those documents in the first place. Minimal code is required to structure each API call, and simple request parameters make it easy to customize new content by providing exact locational details for each addition to your documents. Below, we’ll take a closer look at each of our four PDF Annotation APIs and the way they can each be used to impact your PDF editing workflow.

Add One or More PDF Annotations, Comments in the PDF Document

When creating a new annotation or comment in a PDF, a variety of important information is required at the outset to define the body of the new content and its specific location within the document.

This API iteration allows you to structure a single request determining all relevant details for new annotations or comments at once. Each request can be customized to define the Title, Subject, Text Contents, Annotation Index, and Annotation Type (e.g., “Text”); in addition, integers can be specified to determine the Page Number, LeftX, TopY, Width and Height specifications which will collectively place the annotation/comment at a specific point of your choosing within the document. Timespan format can also be used to set the creation and modification dates for each annotation or comment according to your preference. Once your request is submitted, the underlying service will simply return the encoding for the modified PDF file.

Get PDF Annotations, Including Comments in the Document

Before taking action to remove or edit existing comments and annotations within a PDF file, it’s highly beneficial to first retrieve details about their index, their location within the document, and their exact contents. Calling the “Get PDF Annotations” API iteration will automatically retrieve this information, structured in a similar way to the “Add One or More PDF Annotations” input request.

Remove a Specific PDF Annotation, Comment in the Document

After retrieving data about all the comments or annotations within a document, it’s possible to remove specific annotations individually using the annotation index. In its request parameters, this API iteration requires the input file path along with the annotation index(es) for removal, and it subsequently returns the encoding for the PDF File with the specified annotations or comments removed.

Remove All PDF Annotations, Including Comments in the Document

If your goal is to indiscriminately clear a document of all its annotations or comments, there’s no need to retrieve details about each one of them first. You can structure your request to our “Remove All PDF Annotations” iteration with your file path alone, and the underlying service will return your document with all annotations and comments removed.

For more information on our PDF Annotation (or PDF Editing) APIs, please do not hesitate to contact a member of our sales team.

800 free API calls/month, with no expiration

Get started now! or Sign in with Google

Questions? We'll be your guide.

Contact Sales