How Instant JSON Works
Instant JSON stores PDF changes like annotations 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 instead of the complete PDF.
Conceptually, Instant JSON defines a list of skippedPdfObjectIds
. These point to the PDF’s internal object IDs for annotations. Whenever an object ID is marked as skipped, it’ll no longer be loaded from the original PDF. Instead, it could be defined inside the annotations
array with the same pdfObjectId
. If this is the case, the PDF viewer will display the new annotation, which signals an update to the original one. If an object ID is marked as skipped but the annotations
array doesn’t contain an annotation with the same pdfObjectId
, it’ll be interpreted as a deleted annotation. An annotation inside the annotations
array without the pdfObjectId
property is interpreted as a newly created annotation.
All annotations in the annotations
array have a unique id
field. For updated annotations that were in the original PDF, this field will be the stringified pdfObjectId
. Newly created annotations will get a newly generated ULID.
An “empty” Instant JSON contains neither skippedPdfObjectIds
nor annotations
, which means the original PDF is untouched. All annotations in the initial PDF are still shown.