Global

Type Definitions




Type Definitions

@callback()

This event is emitted when the list of users mentioned in a comment changes or a new comment is created with mentions. The modifications property contains a list of modifications that were applied to the comment. Each modification contains the user ID and the action that was performed.

The event is only emitted for the user that created or updated the comment either via the UI or the API. If you want to listen for changes to comments made by other users, you can use the comments.create, comments.change and comments.delete event. You get the affected comment in the event payload and can check the mentioned users using PSPDFKit.Comment.getMentionedUserIds method.

Example

Listen for changes to the changes in the list of mentioned users in a comment

instance.addEventListener("comments.mention", (event) => {
 const { comment, modifications } = event;
 modifications.forEach((modification) => {
   const { userId, action } = modification;
   if (action === "ADDED") {
     console.log(`User ${userId} was mentioned in comment ${comment.id}`);
   } else {
     console.log(`User ${userId} was unmentioned in comment ${comment.id}`);
   }
 });
});

AnnotationResizeStartCallbackConfiguration

The configuration of the resizing behavior of the annotations

Properties:
Name Type Attributes Description
maintainAspectRatio boolean <nullable>

set to true to keep aspect ratio while resizing.

minWidth number <nullable>

minimum width of the annotation while resizing.

maxWidth number <nullable>

maximum width of the annotation while resizing.

minHeight number <nullable>

minimum height of the annotation while resizing.

maxHeight number <nullable>

maximum height of the annotation while resizing.

AnnotationToolbarItemsCallbackOptions

The additional options that are passed to PSPDFKit.AnnotationToolbarItemsCallback.

Type:
  • object
Properties:
Name Type Description
defaultAnnotationToolbarItems Array.<PSPDFKit.AnnotationToolbarItem>

The list of default items that are shown for this particular annotation.

hasDesktopLayout boolean

Whether the screen is in desktop layout.

AnnotationsUnion

A union of all annotation types.

Type:

ColorPreset

Type:
  • object
Properties:
Name Type Description
color PSPDFKit.Color | null

The Color represented by this preset. Eg: new PSPDFKit.Color({ r: 255, g: 139, b: 94 }).

localization Localization

FontCallback(fontName)

On Standalone, this callback receives the name of a font to retrieve as an argument and you can return from it a Promise that resolves to a Blob with the font data to use.

See this guide to learn more.

Parameters:
Name Type Description
fontName string

The name specified on the same PSPDFKit.Font constructor.

Example

Create a custom font for retrieving "Arial.ttf"

new PSPDFKit.Font({
  name: "Arial.ttf",
  callback: name => fetch(`https://example.com/${name}`).then(r => r.blob());
})

LineCapPresets

Type:
  • "none" | "square" | "circle" | "diamond" | "openArrow" | "closedArrow" | "butt" | "reverseOpenArrow" | "reverseClosedArrow" | "slash"

Localization

Type:
  • object
Properties:
Name Type Attributes Description
id string

Eg: 'purple'

defaultMessage string <nullable>

Default Localization message. Eg: 'Purple'

description string <nullable>

Description of the localization message. Eg: 'Purple Color'

MentionableUser

Type:
  • object
Properties:
Name Type Attributes Description
id string

The unique ID of the user.

name string

The name of the user.

avatarUrl string <optional>

The URL of the user's avatar.

displayName string

The display name of the user.

description string <optional>

The description of the user. This is shown in the mention list. If you want to show the email, you can pass it here.

Text

Type:
  • object
Properties:
Name Type Description
format string

The format of the text. Either plain or xhtml.

value string

The text value.