Skip to main content

Annotation sync strategies

The default behavior of the annotation sync feature can be configured using the methods below.

Handling unknown users#

By default, when a synced annotation is found that was created by a user that does not exist in your database, the annotation author is replaced with the current user.

However, you can change this functionality by providing the annotationSyncSettings.unknownUserStrategy and passing one of the below strategies.

AnnotationSyncUnknownUserStrategy.OVERWRITE_CURRENT_USER#

The default behavior when syncing annotations created by unknown users. This strategy will replace the unknown user with the currently signed in user (AKA the user who performed the sync operation).

AnnotationSyncUnknownUserStrategy.USE_USERNAME#

This strategy maintains the username of the external user who created the annotation. Using this strategy will set the authorId to null in your database, and tells the client to use the username of the person who created the annotation.

Example

import CollabServer from '@pdftron/collab-server'
const server = new CollabServer({
...options,
annotationSyncSettings: {
unknownUserStrategy: CollabServer.AnnotationSyncUnknownUserStrategy.USE_USERNAME
}
})