Skip to content
ComPDF
New Release

Open-Source PDF SDK & AI Document Processing

Get the full self-hosted SDK and AI document processing on GitHub. One-click deploy to quickly build your document workflows.

Stamps

Stamps are image-based annotations dropped onto the page. The WebViewer supports standard, dynamic, and custom stamps, managed through the stamp panel and a set of UI APIs.

UI APIs

UI.setStampPanelTabs(tabs)

Configure the tabs shown in the stamp panel.

javascript
UI.setStampPanelTabs(['standard', 'dynamic', 'custom']);   // STANDARD / DYNAMIC / CUSTOM

Calls useViewer.setStampPanelTabs(tabs). Tab identifiers: Standard, Dynamic, Custom (defined in constants/dataElements.js).

UI.setImportStamps(images)

Set the list of stamps available for import.

javascript
UI.setImportStamps([{ src: '/stamps/approved.png', label: 'Approved' }]);

Calls useViewer.setImportStamps(images).

UI.addCustomStamps(images)

Add custom stamp images.

javascript
UI.addCustomStamps([{ src: dataUrl, label: 'My Stamp' }]);

Calls useViewer.addCustomStamps(images). Custom stamps are persisted to localStorage under the customStamps key.

UI.setCustomStamps(stamps)

Replace the set of custom stamps.

javascript
UI.setCustomStamps([ /* full stamp list */ ]);

Calls useViewer.setCustomStamps(stamps).

UI.getCustomStamps()

Get the current custom stamps.

javascript
/**
 * @method UI.getCustomStamps
 */
const stamps = UI.getCustomStamps();

Returns the getCustomStamps getter from the viewer store.

Stamp state (viewer store)

FieldPurpose
customStamps[]Custom stamps (persisted to localStorage).
stampPanelTabs[]Tabs shown in the stamp panel.
importStamps[]Stamps available for import.

Stamp components

  • StampPanel.vue (components/StampPanel/) — the stamp picker with Standard / Dynamic / Custom tabs (tabs set in App/index.vue via setStampPanelTabs). Lazy-loaded.
  • CustomStamp.vue — custom stamp creation UI.
  • DeleteCustomStampDialog — confirm custom stamp deletion.

Core bridge (stamp surface)

The core bridge exposes on instance.Core:

FunctionPurpose
getDynamicStampPreviewGet a dynamic stamp preview.
getStampRectGet the stamp rectangle.
handleStampApply a stamp.

Stamp preview helper

helpers/renderStampPreview.js provides a renderStampPreview class that creates a floating .stamp-preview div following the mouse over the .document area, showing the stamp image before it is placed. Methods: updateStampPreview(...), handleMouseMove, hidePreview, applyStyles.

Examples

Add a custom stamp and open the stamp panel

javascript
UI.addCustomStamps([{ src: '/stamps/draft.png', label: 'Draft' }]);
UI.openElement('stampPanel');

Restrict the stamp panel to standard + custom

javascript
UI.setStampPanelTabs(['standard', 'custom']);

Read current custom stamps

javascript
const stamps = UI.getCustomStamps();