Skip to main content
Titles are a NOTE-only capability; DOC does not support them. Titles can only be created and modified on the main layer (layer=0) of a note file.

Create a Title

Call PluginNoteAPI.setLassoTitle to set the lasso-selected strokes or geometries as a title. Example:
import { PluginNoteAPI } from 'sn-plugin-lib';

PluginNoteAPI.setLassoTitle({ style: 1 })
  .then(data => {
    console.log('setLassoTitle success:', data);
  })
  .catch(error => {
    console.error('setLassoTitle error:', error);
  });
When creating a title, you only need to provide the title style (style).
Before calling this API, you must create a lasso selection on the page; otherwise the API call fails.

Get Lasso Title Data

Call PluginNoteAPI.getLassoTitles to get title data from the current lasso selection. Example:
import { PluginNoteAPI } from 'sn-plugin-lib';

PluginNoteAPI.getLassoTitles()
  .then(data => {
    console.log('getLassoTitles success:', data);
  })
  .catch(error => {
    console.error('getLassoTitles error:', error);
  });
PluginNoteAPI.getLassoTitles can only be called when a lasso context exists. It returns an APIResponse<Title[]>. result is an array of Title. The data structure of Title:
class Title {
  public X: number = 0; // Top-left X
  public Y: number = 0; // Top-left Y
  public width: number = 0; // Width
  public height: number = 0; // Height
  public page: number = 0; // Page number
  public num: number = 0; // Index within the page
  /**
   * Title style mapping:
   * 0: remove title style
   * 1: black background
   * 2: gray-white
   * 3: gray-black
   * 4: shadow
   */
  public style: number = 0;
  // Related stroke indices: which strokes belong to this title
  public controlTrailNums: number[] = [];
}
The comments above describe the meaning of each field.

Modify a Title

After lasso-selecting a title, call PluginNoteAPI.modifyLassoTitle to modify the title data. Example:
import { PluginNoteAPI } from 'sn-plugin-lib';

PluginNoteAPI.modifyLassoTitle({ style: 2 })
  .then(data => {
    console.log('modifyLassoTitle success:', data);
  })
  .catch(error => {
    console.error('modifyLassoTitle error:', error);
  });