/ guide · annotation workflow

How to add annotation events to a CAD viewer in a web application.

Let users create markups inside Rasterex Canvas, then receive the annotation GUID in your host application and connect it to the project, document or review workflow you already own.

Rasterex technical guide

/ short answer

Treat the annotation as a workflow event.

Rasterex provides annotation tools and emits a created event with the annotation GUID. Your host application decides what that GUID means: a review comment, issue, approval, project record or document-management entry.

This guide starts after the viewer is already mounted, Canvas is ready and the document is open. If those foundations are not in place, complete the embedded CAD viewer guide first.

/ implementation model

One viewer action, one host-owned workflow record.

1. Activate a tool

The host application invokes the annotation tool appropriate for the user action.

2. Receive the event

Canvas emits the created event and supplies the annotation GUID to the viewer SDK.

3. Connect your workflow

Your application associates that GUID with its existing business record and access model.

/ verified SDK calls

Subscribe, act, clean up.

These are adaptation snippets. They belong in the screen that owns the viewer instance after its document has opened successfully.

Step 01

Listen for a newly created annotation

application code · typescript
01// Run after mount(), ready() and documents.open().02const stopCreated = viewer.annotations.on("created", (event) => {03  console.log("Created annotation GUID:", event.guid);04});05 06// On screen cleanup, unsubscribe the listener.07stopCreated();
Step 02

Activate and clear a text-annotation tool

application code · typescript
01// Activate the documented text-annotation tool.02viewer.tools.set({03  group: "annotation",04  action: "TEXT",05  enabled: true,06});07 08// Return the viewer to its normal navigation state.09viewer.tools.clear();

The event subscription and tool commands are documented by Rasterex. The code that persists the GUID belongs to your host application because its API, authorization and data model are product-specific.

/ validation

Verify the handoff, not just the markup.

  • The viewer is mounted, ready and displaying the intended document before the tool is enabled.
  • Creating a text annotation emits a created event and logs a GUID.
  • The host application associates that GUID with the correct document and workflow record.
  • The event subscription is stopped when the host screen unmounts.
/ common questions

Annotation event answers.

How do I detect when a user creates an annotation?

Subscribe to viewer.annotations.on("created", callback) after the viewer is mounted, Canvas is ready and a document is open. Rasterex provides the created annotation GUID in the event.

How do I activate an annotation tool from my application?

Use viewer.tools.set with the annotation group and required action. For example, viewer.tools.set({ group: "annotation", action: "TEXT", enabled: true }) activates the documented text-annotation tool.

Where should annotation workflow data be saved?

Rasterex provides the viewer event and annotation GUID. The host application should associate that identifier with its own document, project, issue or review record according to its existing workflow and authorization model.

/ next step

Turn annotations into a product workflow.

Define the host-side record that should receive the annotation GUID, then validate the full workflow with the users, permissions and documents that matter in production.

/ get started

Ready to put CAD, BIM and PDF inside your app?

Explore documentation