Skip to main content
FLEX Canvas lets users mark up images and PDFs with shapes, notes, drawing and text. It stores those marks in a separate layer so the original file stays intact. Add it to a FLEX upload field or attach it to a Filament action. The FLEX Fields workspace disables printing, downloading, adding signatures and managing bookmarks.

Set up annotation storage

Run the optional migration once in your application.

Add an action to File Upload

Use imageAnnotations() on a FLEX upload field. In the example, AssetReview::targetFor() is an application method that authorizes the attachment and returns an ImageAnnotationTarget. Build the target from the authorized workspace, stable attachment identity and current file revision. Return null when access is denied.
The action uses the original owned by the field. Temporary PDFs on a local disk are streamed through an expiring, session-bound link. On S3, allow the application origin to fetch signed PDF URLs through the bucket’s CORS configuration.

Limit the tools for a review

Choose the main toolbar controls, drawing tools and property controls independently. For example, reviewers can navigate a PDF and leave notes without seeing the shape, text and drawing groups.
toolbar.tools controls what reviewers can create. Existing annotations still display as long as the profile allows their types. To open a saved layer for reading, use new ImageAnnotationProfile(readOnly: true, maxPages: 250). Keep access checks in the source resolver for both configurations.

Open a document from another button

Use ImageAnnotationsAction where you register Filament actions. The source resolver runs on open and save. Resolve the attachment on the server, authorize the current user and return its current target, name, URL, layer identifier and media type. Use 'image' for images and 'pdf' for PDFs.
Saving annotations updates the layer. For PDF page editing, explicitly add pdfDocumentEditor() with a callback that verifies the source revision and atomically replaces the document. Enable preserveAnnotations: true to move saved layers with surviving pages. A deleted page’s annotations are excluded from the new revision.

Browser assets

The viewer loads when the action opens. It resolves @useflex/canvas@latest from jsDelivr and keeps the JavaScript, CSS, fonts and worker on the same resolved release for that workspace. Image sessions skip the PDF worker and WebAssembly. If you enforce a Content Security Policy, allow Canvas assets from cdn.jsdelivr.net and version resolution from data.jsdelivr.com. The CDN PDF worker needs blob: in worker-src and permission to compile WebAssembly. Your storage host also needs to permit the browser to fetch the document. For a self-hosted distribution, set filament-flex-fields.canvas.asset_base_url to its dist/browser/ directory and serve the matching parent dist/ files alongside it.
Last modified on November 29, 2026