Some test text!

menu
Connect to serverkeyboard_arrow_down

Connecting to a server to collaborate on documents in realtime

linkHost annotations in your own server

In realtime collaboration, a server will merely act as an online database that triggers events upon data creation/modification/deletion. As long as the above requirement is met, your server can be built in any language and stack of your choice. PDFTron provides an interface that will allow you to connect your data to the out-of-box UI.

  1. Your will need to obtain a reference to CollabManager from the CollabViewerTabHostFragment, then setup the current collaboration session, for example:

    void handleTabDocumentLoaded(String tag) {
        // setup the current collaboration session
        CollabManager collabManager = mCollabViewerTabHostFragment.getCollabManager();
        if (collabManager != null) {
            collabManager.setCurrentUser(mUserId, mUserName);
            collabManager.setCurrentDocument(mDocumentId);
    
            collabManager.setCollabManagerListener(new CollabManager.CollabManagerListener() {
                @Override
                public void onSendAnnotation(String action, ArrayList<AnnotationEntity> annotations, String documentId, @Nullable String userName) {
                    // local change, send info to server here
                }
            });
        }
    }
  2. When your server notifies the client about remote changes, import the XFDF command string with CollabManager:

    void importXfdf(String xfdfCommand) {
        CollabManager collabManager = mCollabViewerTabHostFragment.getCollabManager();
        if (collabManager != null) {
            collabManager.importAnnotationCommand(xfdfCommand);
        }
    }

The annotations appearing on the document in real time are managed through a separate XFDF format, while the original version of the document is preserved on the server. Note that the client downloads the original untouched document at the start of the collaboration session.

And that is it! PDFTron will handle all annotation syncing and annotation reply for you.

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

Join our live demo to learn about use cases & capabilities for WebViewer

Learn more
close