Options
All
  • Public
  • Public/Protected
  • All
Menu

Collaboration is used to view and edit PDF documents collaboratively.

In this release, collaborative editings only support annotations, including note, highlight, underline, strikeout, squiggly, square, circle, free text, stamp, caret, ink, line, polygon, polyline, file attachment, PSInk, redact annotations. The redact annotation is constrained to properties updates, the ‘redaction apply’ is not yet supported in the current version.

Basically, a collaboration is retrieved by creating a new collaboration WebCollabClient.createCollaboration or opening an existing collaboration WebCollabClient.getCollaboration.

A collaboration provides methods to perform actions related to collaborative editings, such as:

  • Add/Update/Remove members of a collaboration.
  • Update permission of a collaboration.
  • Begin/End a collaboration session.

Hierarchy

  • Collaboration

Index

Properties

authorId: string

The id of the collaboration author.

createdAt: number
docName: string

The name of the collaboration document.

id: string

Identifier of the collaboration

isDocPublic: boolean

This property is used for collaboration access control.

  • true : Anyone with the link can access the collaboration.
  • false : Only invited users can access the collaboration.
see

updatePermission

Methods

  • addMembers(members: { email?: string; id?: string; isAllowComment: boolean }[]): Promise<boolean>
  • Add the specified members to the collaboration.

    Parameters

    • members: { email?: string; id?: string; isAllowComment: boolean }[]

      A list of users which will be added to the collaboration.

    Returns Promise<boolean>

    • true: The specified members are added to the collaboration successfully.
    • false: Failed to add the specified members to the collaboration.

    For example

    1.When you add members by user id

    let members = [
    {
    id: user_id,
    isAllowComment: true
    }
    ]
    await collaboration.addMembers(members)

    2.When you add members by user email

    let members = [
    {
    email: user_email,
    isAllowComment: true
    }
    ]
    await collaboration.addMembers(members)
  • begin(fileOptions?: FileOptions): Promise<boolean>
  • Begin the collaboration session.

    An optional fileOptions parameter can be passed in to specify options when opening a PDF file. For example, in order to open an encrypted PDF file, fileOptions.password is needed.

    Parameters

    • Optional fileOptions: FileOptions

      Options that will be passed along to PDFViewer.openPDFByFile when opening a PDF file. Refer to PDFViewer.openPDFByFile for more information.

    Returns Promise<boolean>

    • true when the collaboration session is successfully started, or rejected with error. The error format is: {error:number, pdfDoc: pdfDoc, encryptDict: object}.

    This error should be properly handled in order to proceed with the collaboration.

    For example, when an error = 3, it means a correct password is needed to open the encrypted PDF file. You should prompt the client for a password and call this method again with the provided password.

     collaboration.begin().catch(e => {
    if(e.error === 3){
    const passwordForPDF = await promptForPassword()
    await collaboration.begin({
    password: passwordForPDF
    })
    }
    })
  • createScreenSync(memberIds?: string[]): Promise<ScreenSync>
  • Create a screenSync session.

    Parameters

    • Optional memberIds: string[]

      The list of member ids of the collaboration which will be invited become follower of the screenSync session, defaults to all members of the collaboration which will be invited become follower of the screenSync session.

      When a screenSync session is created,the current user become the leader of the screenSync session, the ScreenSyncEvent.CREATED event is fired for specified member or all members of the collaboration.

    Returns Promise<ScreenSync>

  • end(): Promise<boolean>
  • End current collaboration session.

    Only collaboration owner is allowed to perform this action. The collaboration will no longer be available if succeeded.

    Returns Promise<boolean>

    • true: End the operation successfully.
    • false: Failed to end the collaboration.
  • getAnnotJSON(annotID: string, pageIndex: number): any
  • Get the specified annotation of the current collaboration session by the annotation ID.

    Parameters

    • annotID: string
    • pageIndex: number

    Returns any

    | null>} - The specified annotation information of the current collaboration session.

  • getCurrentUser(): Promise<Member>
  • Get current user of the collaboration.

    Returns Promise<Member>

    • A current user of the collaboration.
  • getMembers(): Promise<Member[]>
  • Get all the members of the collaboration.

    throws

    If the Collaboration has not begun or already ended.

    Returns Promise<Member[]>

    • The list of members of the collaboration.
  • getOnlineMembers(): Promise<Member[]>
  • Get online members of the collaboration.

    Returns Promise<Member[]>

    • A list of online members of the collaboration.
  • Get the permission of the collaboration.

    throws

    If the Collaboration has already ended.

    Returns Promise<Permission>

    • The permission object of the current collaboration.
  • getScreenSync(screenSyncId: string): Promise<ScreenSync>
  • Get a screenSync session by screenSyncId.

    Parameters

    • screenSyncId: string

      The id of the screenSync session.

    Returns Promise<ScreenSync>

  • Get all the screenSync of the collaboration.

    Returns Promise<null | ScreenSync[]>

  • off(): Promise<boolean>
  • Remove all event listeners of the collaboration.

    Returns Promise<boolean>

  • on(event: "onlineStatusChanged", listener: ((actionData: Record<string, any>, action: ScreenSyncEvent | "member-online" | "member-offline" | "delete-share" | "edit-members" | "delete-members" | "network-connection-up" | "network-connection-down") => void)): void
  • Add event listener to the collaboration.

    The event listeners will be called when the corresponding events emitted.

    Parameters

    • event: "onlineStatusChanged"
    • listener: ((actionData: Record<string, any>, action: ScreenSyncEvent | "member-online" | "member-offline" | "delete-share" | "edit-members" | "delete-members" | "network-connection-up" | "network-connection-down") => void)
        • (actionData: Record<string, any>, action: ScreenSyncEvent | "member-online" | "member-offline" | "delete-share" | "edit-members" | "delete-members" | "network-connection-up" | "network-connection-down"): void
        • Parameters

          • actionData: Record<string, any>
          • action: ScreenSyncEvent | "member-online" | "member-offline" | "delete-share" | "edit-members" | "delete-members" | "network-connection-up" | "network-connection-down"

          Returns void

    Returns void

  • quit(): Promise<boolean>
  • Quit the current collaboration.

    The current user will be removed from the member list of this collaboration and the current collaboration session will be ended.

    Returns Promise<boolean>

    • true: Quit the current collaboration successfully.
    • false: Failed to quit the current collaboration.
  • removeMembers(members: { id: string }[]): Promise<boolean>
  • Remove the collaboration members by specified ids.

    Parameters

    • members: { id: string }[]

    Returns Promise<boolean>

    • true: Remove the collaboration members successfully.
    • false: Failed to remove the collaboration members.
  • setMousePointerSyncRate(syncRate: number): boolean
  • Set the time interval at which mouse pointer position is sent to the server, in milliseconds.

    The default value is 200 milliseconds. It's recommend to set a value greater than 50 milliseconds.

    Parameters

    • syncRate: number

      the time interval in milliseconds.

    Returns boolean

    • true: sync rate is updated successfully.
    • false: Failed to set sync rate.
  • updateMemberPermission(members: { id: string; isAllowComment: boolean }[]): Promise<boolean>
  • Update members permission of Collaboration.

    Parameters

    • members: { id: string; isAllowComment: boolean }[]

    Returns Promise<boolean>

    • true: Update members permission of Collaboration successfully.
    • false: Failed to update members permission.
  • updatePermission(permissionOption: { isAllowComment?: boolean; isDocPublic?: boolean }): Promise<boolean>
  • Update the collaboration permission.

    Parameters

    • permissionOption: { isAllowComment?: boolean; isDocPublic?: boolean }
      • Optional isAllowComment?: boolean
        • true:The current user is allowed to add comments.
        • false: The current user is not allowed to add comments. Only view the document.
      • Optional isDocPublic?: boolean
        • true: Anyone with the link can access.
        • false: Only invited users can access.

    Returns Promise<boolean>

    • true: Update the collaboration permission successfully.
    • false: Failed to update the collaboration permission.

Generated using TypeDoc