# Supernote: English API reference ## API reference ### Supernote Plugin SDK #### PluginCommAPI - [PluginCommAPI](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/index.md): Common APIs that can be called in both NOTE and DOC. - [createElement](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/create-trail.md): Create a new Element object. - [recycleElement](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/recycle-trail.md): Recycle an Element object and release native Android cache on the native side. - [clearElementCache](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/clear-trail-cache.md): Clear the Android local cache for Elements. After clearing, previously obtained Element objects can no longer be used. - [getCacheElement](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-cache-element.md): Get cached Element data by uuid (including strokes, links, titles, geometries, and text boxes). - [saveStickerByLasso](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/save-sticker-by-lasso.md): Save lasso-selected strokes as a sticker. - [getStickerSize](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-sticker-size.md): Get sticker size. - [generateStickerThumbnail](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/generate-sticker-thumbnail.md): Generate a sticker thumbnail. - [convertElement2Sticker](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/convert-trail2-sticker.md): Convert elements to a sticker. - [insertSticker](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/insert-sticker.md): Insert sticker. - [setLassoBoxState](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/set-lasso-box-state.md): Set lasso box state. - [getLassoRect](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-lasso-rect.md): Get the lasso rectangle. - [lassoElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/lasso-elements.md): Create a lasso selection for elements in a rectangle. - [resizeLassoRect](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/resize-lasso-rect.md): Resize the lasso rectangle. - [flipLassoElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/flip-lasso-elements.md): Flip the elements in the current lasso selection in place. - [getLassoElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-lasso-data.md): Get lasso data (element list). On success, accessor fields are filled. - [getLassoElementTypeCounts](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-lasso-data-type-counts.md): Get lasso element type counts. - [deleteLassoElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/delete-lasso-data.md): Delete lasso-selected elements. - [getCurrentPageNum](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-current-page-num.md): Get the current page index of the currently opened file. - [canHandwrite](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/can-handwrite.md): Check whether the current view supports EMR handwriting. - [jumpToPage](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/jump-to-page.md): Jump to the specified page in the current file. - [getPageDisplaySize](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-page-display-size.md): Get the display size of the current page. - [modifyPageElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/modify-page-elements.md): Modify existing elements on the specified page in the current file. - [insertPageElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/insert-page-elements.md): Insert elements into the specified page in the current file. - [deletePageElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/delete-page-elements.md): Delete elements from the specified page in the current file. - [batchUpdatePageElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/batch-update-page-elements.md): Batch update elements on the specified page in the current file. - [getCurrentFilePath](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-current-file-path.md): Get the file path of the currently opened file. - [getPenInfo](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-pen-info.md): Get current pen information. - [recognizeElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/recognize-elements.md): Recognize elements as text. - [cancelRecognize](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/cancel-recognize.md): Cancel the ongoing recognition task initiated by [recognizeElements](/en/api-reference/supernote-plugin/plugin-comm-api/recognize-elements). - [reloadFile](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/reload-file.md): Reload the currently opened NOTE/DOC file. - [getLassoGeometries](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-lasso-geometries.md): Get lasso-selected geometries. - [insertGeometry](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/insert-geometry.md): Insert geometry. - [modifyLassoGeometry](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/modify-lasso-geometry.md): Modify the lasso-selected geometry. - [getNoteSystemTemplates](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/get-note-system-templates.md): Get system note templates. You can use these templates when creating note files. - [insertFiveStar](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/insert-five-star.md): Insert a five-point star into the current file and page (and current layer for NOTE). - [generateLassoPreview](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-comm-api/generate-lasso-preview.md): Generate preview image data for lasso elements. #### PluginNoteAPI - [PluginNoteAPI](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/index.md): NOTE-related API index. APIs in this section can only be called in NOTE. - [getLassoLinks](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/get-lasso-link.md): Get lasso link data. - [setLassoStrokeLink](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/set-lasso-stroke-link.md): Set lasso-selected elements as a link. - [insertTextLink](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/insert-text-link.md): Insert a text link into the main layer of the currently opened note page. - [modifyLassoLink](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/modify-lasso-link.md): Modify link data. - [saveCurrentNote](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/save-current-note.md): Save the currently opened note file. - [setLassoTitle](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/set-lasso-title.md): Set lasso-selected strokes or geometries as a title. - [getLassoTitles](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/get-lasso-title.md): Get lasso-selected titles. - [modifyLassoTitle](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/modify-lasso-title.md): Modify lasso title. - [getLassoText](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/get-lasso-text.md): Get lasso-selected TextBox elements. - [insertText](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/insert-text.md): Insert TextBox. - [modifyLassoText](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/modify-lasso-text.md): Modify the lasso-selected TextBox. - [insertImage](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/insert-image.md): Insert an image into the current layer of the current note page. - [generateLayerPreviewImage](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-note-api/generate-layer-preview-image.md): Generate a thumbnail image for a layer. #### PluginDocAPI - [PluginDocAPI](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-doc-api/index.md): DOC-related API index. - [getLastSelectedText](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-doc-api/get-last-selected-text.md): Get the last selected text content. - [getCurrentDocText](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-doc-api/get-current-doc-text.md): Get text content of a page in the currently opened DOC. - [getCurrentTotalPages](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-doc-api/get-current-total-pages.md): Get total page count of the currently opened DOC. - [generateCurrentDocImage](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-doc-api/generate-current-doc-image.md): Generate a PNG image for a specified page of the current document. #### PluginFileAPI - [PluginFileAPI](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/index.md): File-related API index. - [getElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-page-trails.md): Get page elements, including strokes, links, titles, TextBox elements, and five-star elements. - [replaceElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/replace-trails.md): Replace all elements on a page. - [insertElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/insert-trails.md): Insert elements into a NOTE/DOC file page. - [modifyElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/modify-trails.md): Modify existing page elements (only existing elements can be modified). - [deleteElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/delete-elements.md): Delete existing page elements (only existing elements can be deleted). - [getTitles](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-titles.md): Get titles from a NOTE file. - [getKeyWords](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-key-words.md): Get keywords from a NOTE/DOC file. - [insertKeyWord](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/insert-key-word.md): Insert keyword. - [deleteKeyWord](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/delete-key-word.md): Delete a keyword from a NOTE/DOC file. - [getNoteTotalPageNum](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-note-total-page-num.md): Get the total page count of a note file. - [getPageSize](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-page-size.md): Get page size of a file (pixels). - [generateNotePng](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/generate-note-png.md): Generate a PNG for a note page. - [searchFiveStars](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/search-five-stars.md): Search a file for five-star elements and return the page indices. - [createNote](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/create-note.md): Create a note file. - [removeNotePage](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/remove-note-page.md): Delete a page from a note file. - [insertNotePage](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/insert-note-page.md): Insert a new page into a note file. - [clearLayerElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/clear-page-layer-data.md): Clear elements on a specific layer of a note page. - [getLayers](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-layers.md): Get layer data of a note page. - [modifyLayers](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/modify-layers.md): Modify page layer data (non-existent layers are ignored). - [insertLayer](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/insert-layer.md): Insert a layer. - [deleteLayers](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/delete-layers.md): Delete layers. - [sortLayers](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/sort-layers.md): Sort layers (the first layer is on top). - [getMarkPages](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-mark-pages.md): Get the page indices that have mark pages in a DOC file. - [generateMarkThumbnails](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/generate-mark-thumbnails.md): Generate a thumbnail for a DOC mark page. - [clearMarkElements](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/clear-mark-trails.md): Clear handwriting elements in a DOC file. - [getNotePageTemplate](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-note-page-template.md): Get the template information of a note page. - [generateNoteTemplatePng](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/generate-note-template-png.md): Generate a background-template PNG for a note page. - [getNoteType](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-note-type.md): Get a note file type. - [getFileMachineType](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-file-machine-type.md): Get the device type that created this note/annotation file. - [getElementCounts](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-element-counts.md): Get the number of elements on a note page. - [getElementNumList](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-element-num-list.md): Get the element number list for a note page. - [getElement](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-element.md): Get an element from a note page by element number. - [getLastElement](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-last-element.md): Get the last element of the current note page. - [openFile](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/open-file.md): Open the specified document or note file. - [getPathEncryptionStatus](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/get-path-encryption-status.md): Get the encryption status of a file or directory. - [unlockPathWithPassword](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/unlock-path-with-password.md): Unlock an encrypted file or directory with a password. - [lockPathAccess](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-file-api/lock-path-access.md): Reset the unlock state of an encrypted file or directory back to locked. #### PluginManager - [Overview](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/index.md): Management entry for plugin lifecycle, buttons, and event listeners. - [init](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/init.md): Initialize the plugin environment. - [registerPluginLifeListener](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/register-plugin-life-listener.md): Listen for plugin lifecycle events. - [registerLangListener](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/register-lang-listener.md): Listen for system language changes. - [registerEventListener](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/register-event-listener.md): Register a plugin event listener. - [registerMotionListener](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/register-motion-listener.md): Register a touch move event listener. - [Plugin Button Registration and Listener](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/register-button.md): Register plugin buttons and listen for button press events. - [unregisterButton](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/unregister-button.md): Unregister a plugin button. - [getButtonState](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/get-button-state.md): Get whether a plugin button is enabled. - [setButtonState](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/set-button-state.md): Enable or disable a button. - [Config Button Registration and Listener](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/register-config-button.md): Register the plugin config button and listen for config button click events. - [getPluginDirPath](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/get-plugin-dir-path.md): Get the plugin installation directory path. - [getPluginName](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/get-plugin-name.md): Get pluginname. - [getDeviceType](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/get-device-type.md): Get devicetype. - [closePluginView](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/close-plugin-view.md): Close the plugin UI. - [hasPermission](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/has-permission.md): Check whether the plugin already has a specific permission. - [requestPermission](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/request-permission.md): Request a specific permission and return the user's authorization choice. - [showPluginView](https://docs.supernote.com/en/api-reference/supernote-plugin/plugin-manager/show-plugin-view.md): Show the plugin UI. #### Utils - [PointUtils](https://docs.supernote.com/en/api-reference/supernote-plugin/utils/point-utils/index.md): Conversion utilities between the EMR coordinate system and screen pixel coordinates. Kept only for `sn-plugin-lib` `0.1.65` and earlier; not recommended for later versions. - [androidPoint2Emr](https://docs.supernote.com/en/api-reference/supernote-plugin/utils/point-utils/android-point2-emr.md): Convert a screen pixel point to an EMR coordinate point. - [emrPoint2Android](https://docs.supernote.com/en/api-reference/supernote-plugin/utils/point-utils/emr-point2-android.md): Convert an EMR coordinate point to a screen pixel point. #### Types - [Overview](https://docs.supernote.com/en/api-reference/supernote-plugin/types/index.md): SDK data structures and constants. - [APIResponse](https://docs.supernote.com/en/api-reference/supernote-plugin/types/api-response.md): Unified API return result. - [Point](https://docs.supernote.com/en/api-reference/supernote-plugin/types/point.md): 2D point coordinate. - [Rect](https://docs.supernote.com/en/api-reference/supernote-plugin/types/rect.md): Rectangle region (top-left / bottom-right). - [Size](https://docs.supernote.com/en/api-reference/supernote-plugin/types/size.md): sizeobject. - [ElementDataAccessor](https://docs.supernote.com/en/api-reference/supernote-plugin/types/trail-data-accessor.md): Accessor for large point datasets and the point data types it provides. - [Stroke](https://docs.supernote.com/en/api-reference/supernote-plugin/types/stroke.md): Raw stroke data (present when an Element is a stroke). - [PenInfo](https://docs.supernote.com/en/api-reference/supernote-plugin/types/pen-info.md): Pen information. - [RecognData](https://docs.supernote.com/en/api-reference/supernote-plugin/types/recogn-data.md): Recognition point data. - [RecogResultData](https://docs.supernote.com/en/api-reference/supernote-plugin/types/recog-result-data.md): Element recognition result data structure. - [Geometry](https://docs.supernote.com/en/api-reference/supernote-plugin/types/geometry.md): Geometry data. - [Picture](https://docs.supernote.com/en/api-reference/supernote-plugin/types/picture.md): Picture element data. - [Template](https://docs.supernote.com/en/api-reference/supernote-plugin/types/template.md): System note template data. - [KeyWord](https://docs.supernote.com/en/api-reference/supernote-plugin/types/key-word.md): Keyword data type. - [Layer](https://docs.supernote.com/en/api-reference/supernote-plugin/types/layer.md): Layer data type. - [Element](https://docs.supernote.com/en/api-reference/supernote-plugin/types/trail.md): Unified data structure for visible elements in notes/documents. - [TextLink](https://docs.supernote.com/en/api-reference/supernote-plugin/types/text-link.md): TextLink data structure (used for insertTextLink). - [Link](https://docs.supernote.com/en/api-reference/supernote-plugin/types/link.md): Link element detail data structure. - [LassoLink](https://docs.supernote.com/en/api-reference/supernote-plugin/types/lasso-link.md): Link data structure returned from lasso selections. - [Title](https://docs.supernote.com/en/api-reference/supernote-plugin/types/title.md): Title data structure in NOTE. - [TextBox](https://docs.supernote.com/en/api-reference/supernote-plugin/types/text-box.md): TextBox data structure in NOTE. - [PluginButton](https://docs.supernote.com/en/api-reference/supernote-plugin/types/plugin-button.md): PluginButton data structure. - [ButtonListener](https://docs.supernote.com/en/api-reference/supernote-plugin/types/button-listener.md): Button event listener type. - [ButtonSubscription](https://docs.supernote.com/en/api-reference/supernote-plugin/types/button-subscription.md): Button event subscription type. - [MotionEvent](https://docs.supernote.com/en/api-reference/supernote-plugin/types/motion-event.md): Touch move event callback data.