File Demo Description
This page demonstrates file embedding and preview in CanvasX. You can use file widgets to upload, display, and interact with various file types (PDF, images, docs, etc.) directly on your canvas.
File Widget Documentation
Overview
CanvasX supports embedding and previewing files as objects on the canvas. This is useful for sharing documents, images, and other files in a collaborative workspace.
Key Properties
- src: string — The file URL or data source.
- type: string — The file type (e.g., 'pdf', 'image', 'doc').
- width, height: number — The dimensions of the file preview.
- top, left: number — The position of the file on the canvas.
Usage Example
const file = new XFile({ src: 'https://example.com/file.pdf', type: 'pdf', top: 100, left: 100, width: 400, height: 300, }); canvas.add(file);
Tips & Best Practices
- Use file widgets to share and preview documents in collaborative sessions.
- Combine files with notes and diagrams for richer context.
- Resize and position file previews for optimal viewing.