After selecting a product, color, and size on the product detail page, Krafta sends you to the design editor — a full-screen canvas workspace where you upload your artwork, position it precisely over the product’s print area, and generate a preview image that travels with your order all the way to the workshop.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/PloutusLab/krafta-web/llms.txt
Use this file to discover all available pages before exploring further.
How the editor works
The editor is built on top of Fabric.js, a powerful HTML5 canvas library. At the center of the interface sits the product’s SVG mockup, rendered inside adiv container. Fabric.js then mounts a transparent canvas element positioned exactly over the print area element inside that SVG — matched by querying for elements whose id contains krafta-print-area or _x23_krafta-print-area — so anything you place on the canvas sits precisely within the printable zone of the mockup.
When the page loads, the editor:
- Fetches the product’s SVG blueprint from the server.
- Parses the SVG for elements whose
idcontainskrafta-print-areaor_x23_krafta-print-areato determine canvas placement. - Measures the print area’s bounding box and positions the Fabric.js canvas to match it exactly, accounting for the current zoom level.
- Hides the print area vector guide (sets its opacity to 0) so it does not interfere with your design.
- Draws a dashed purple border (2 px,
rgba(94, 48, 250, 0.5)) on the canvas to show the printable boundary. - Scans the SVG for any elements whose
idcontainskrafta-var-or_x23_krafta-var-and exposes them as color pickers in the right sidebar.
Uploading a design
Click the Upload button in the left toolbar to open your file picker. Supported formats: Any image file accepted by your browser (image/*) — PNG and JPG are the most common choices.
Once a file is selected, Fabric.js loads the image, scales it to 80% of the canvas width, and centers it inside the print area. You can then reposition, resize, or rotate it freely.
Only PNG files support transparent backgrounds. If you upload a JPG, any white areas in the image will print as solid white ink. Use PNG with a transparent background for designs that should show the product color underneath.
Manipulating your design on the canvas
Once your image is on the canvas, Fabric.js gives you full interactive control:| Action | How to do it |
|---|---|
| Move | Click and drag the image to any position inside the canvas |
| Resize | Drag any of the eight corner or edge handles |
| Rotate | Drag the circular rotation handle above the selection box |
| Zoom in / out | Use the + and − buttons in the bottom-left zoom control |
Adjusting product colors
SVG elements withkrafta-var- (or _x23_krafta-var-) in their id attribute represent customizable fill zones on the product — for example, the base fabric color of a hoodie or a background panel on a tote bag. Each such element appears as a labeled color picker in the Variants & Layers right sidebar.
The label shown for each variable is derived from the element’s id by stripping the krafta-var- or _x23_krafta-var- prefix and replacing underscores with spaces.
Clicking a color picker opens the browser’s native color chooser. As you select a color, the corresponding SVG element updates its fill in real time, giving you an accurate preview of the final product.
If no krafta-var- elements are found in the SVG blueprint, the sidebar shows a message indicating there are no dynamic color variables for that product.
Print area boundary
A dashed purple border is always visible on the canvas to mark the exact boundary of the printable zone. This border is a non-selectable Fabric.jsRect object — it cannot be accidentally moved or deleted.
Any part of your design that extends beyond the dashed purple border will be clipped during printing. Keep all important elements — logos, text, fine details — visibly inside the boundary.
Saving and previewing
When you are happy with the placement, click Finish Design in the right sidebar. Krafta callsfabricCanvas.toDataURL({ format: 'png', quality: 1 }) to render the canvas contents into a PNG data URL and passes it to the parent page via the onSave callback with the following shape:
- Displayed on the checkout and order pages so you and the admin can verify what was designed.
- Attached to the order record so the assigned workshop sees exactly what to print.
- Used for the product thumbnail on your order history page.
