Frameworks
Integrations
Mendix
SharePoint
Modular UI
Legacy UI
AnnotationManager
Annotation Types
Customize
Version 11
Version 10
v10.12
v10.11
v10.10
v10.9
v10.8
v10.7
v10.6
v10.5
v10.4
v10.3
v10.2
v10.1
v10.0
Version 8
v8.12
v8.11
v8.10
v8.9
v8.8
v8.7
v8.6
v8.5
v8.4
v8.3
v8.2
v8.1
v8.0
Version 7
Version 6
v6.3
v6.2
v6.1
v6.0
Version 5
Version 4
Version 3
Version 2
WebViewer Server
WebViewer BIM
WebViewer's JavaScript document collaboration library contains APIs that allow you to export/import annotations from/to a document. Using those APIs and a server, you can set up realtime collaboration easily.
Apryse does not ship any server side collaboration tools - you must take the basic concepts outlined below and use them to implement your own flow within your application.
Enabling collaboration in WebViewer requires you to build a server that can sync annotations back and forth between users. This typically involves storing annotation data (XFDF) in a database and enabling some kind of real-time connection between your clients and your server. This is typically accomplished through the use of Web Sockets.
You can use any backend technologies you wish. We provide samples using SQLite and Firebase, but collaboration is not restricted to these technologies.
Setting up real time collaboration typically involves binding to the WebViewer annotationChanged
event, and syncing the clients annotation state with your servers annotation state.
This usually will look something like this
The addAnnotations, modifyAnnotations, and deleteAnnotations functions will typically contain your own logic to extract the XFDF from the changed annotations and push the updates to your server.
Here's an example of what an addAnnotation
function might look like.
It is recommended to assign a unique ID to each document in your system. This will allow you to easily fetch and sync annotations on a per-document basis.
You should generate these ID's with your own system instead of using the ID generated by WebViewer.
Once you have your client sending XFDF data to your server, you need to update your server to handle that data. This will typically involve setting up endpoints for each annotation operation (add, modify, delete).
Each of these endpoints should have 3 primary functions:
User authentication will depend on your server technology, so that will not be explained in this guide.
Syncing the annotation to your database will usually mean writing the XFDF, the userId, the documentId, and an annotationId.
If you are using an ORM like Prisma, this could look like this:
The same logic applies for modifying data, except instead of writing a new row to your database, you will be editing or deleting an existing row.
Once you have your basic annotation sync in place, you can start implementing the real-time updates between users.
There are many strategies you can use to accomplish this, but the most common are
If possible, we recommend using WebSockets as they provide a true real-time user experience.
The general strategy to implementing real-time updates is as follows
Here is a code sample using socket.io to show what this might look like:
The final piece of functionality for a basic real-time collaboration flow is displaying a document's annotations on load.
This is done by querying all the annotations belonging to the document from your database, and importing the XFDF for those annotations into WebViewer.
Here is an example of what this might look like:
The rest of the guides in this section walk you through how to implement a real-time collaboration flow using Firebase using the same concepts we discussed above.
Get started by setting up your viewer.
If you are not using firebase, we still recommend reading the remaining guides as the same concepts with almost any technology stack.
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales