Adding Instant comments to PDFs in Flutter

PSPDFKit for Flutter provides user interface (UI) components for viewing, adding, and deleting comments in PDF documents. This component, Instant Comments, is available only if you’re using PSPDFKit Instant.

You can use comments to build collaborative workflows where multiple users can discuss specific sections of a document without leaving the viewer. The PSPDFKit Instant engine allows users to receive updates in real time.

Licensing

Comments require a separate component in your PSPDFKit license. Without this included in your license, your app won’t be able to view, search, or add comments. Please contact our Sales team to add comments to your license.

If you’re a new customer, you can try comments without a license key. If you’re an existing customer, please ask our Sales team for a trial license if you’re interested.

Terminology

Before continuing, it’s helpful to first define some terminology as it relates to comments:

  • root annotation — This is the annotation to which all the comments in a single thread are linked.

  • comment thread — This is a group of comments with the same root annotation.

  • comment — This is a single comment added by any user.

Introduction

All comments are linked to their respective root annotations. The comments with the same root annotation are part of a single comment thread. There can be two types of root annotations:

  • Markup annotation — You can start a new comment thread by selecting some text and tapping the comment menu item (comment icon). In this case, the text markup annotation created will act as a root annotation.

  • Comment marker annotation — A comment marker annotation is a new annotation that can be added anywhere in a PDF document and used to start comment threads.

Getting Started

The PSPDFKit Instant Comments tool is disabled by default. If your Document Engine license includes it, you can explicitly enable the tool by setting the enableInstantComments configuration option to true:

Pspdfkit.presentInstant(
  serverUrl: 'YOUR_SERVER',
  jwt: 'YOUR_JWT',
  configuration: {
    enableInstantComments: true,
  }
);

Adding a Comment

Since there are two types of root annotations, there are two ways you can add comments with the user interface.

Note that, at the moment, we don’t support the addition of comments or comment marker annotations using programmatic APIs. This is something that might change in future.

Deleting a Comment

Document Engine currently doesn’t expose any APIs for deleting a comment.

Information

Comment editing isn’t supported in the current version.

For more details on comments, check out the native Android and iOS guides.