PDF Annotation Diffs in Our JavaScript Viewer

Transferring PDF documents over the network is wasteful, since their content doesn’t often change — with the exception of document annotations. Both Server-Backed and Standalone operational modes of PSPDFKit for Web solve this problem for you, albeit in different ways.


Files uploaded to Document Engine are processed on upload, with all their annotations extracted into a database. Whenever PSPDFKit for Web Server-Backed requests document annotations, Document Engine returns only the annotations without transferring the original file. This saves network resources and keeps the file data private on the server.

When PSPDFKit for Web Server-Backed changes (creates, updates, or deletes) annotations, only the affected annotations — and not the full PDF document — are transferred over the network:

  • Only the annotations that are affected by the change are transferred when creating or updating annotations.

  • Only the list of deleted annotation IDs is transferred when deleting annotations.

Once the changes are accepted by Document Engine, other clients that are currently connected to the same document via PSPDFKit Instant will immediately get an update with a diff representing the changes.


In Standalone mode of PSPDFKit for Web, annotations are stored in memory until they’re exported. When you need to save changes to your remote server or share them between your clients, consider using Instant JSON as a serialization format instead of transferring the whole PDF file.

Instant JSON was designed as a modern serialization format to store PDF annotations (and form fields, form field values, and bookmarks) in a separate JSON file. This means that a PDF document will only need to be transferred once, and all changes will be added as an overlay to the existing PDF. This approach significantly reduces the bandwidth, since you only need to transfer the JSON and not the complete PDF.

Please see the guide on importing and exporting for more information.