SuperPrint exposes a scripting API on the global object window.SuperPrint inside the
editor. Use it from the browser console, from a <script> you inject, or from an
automation tool driving the page. It lets you build layouts programmatically: add text, shapes and
images, manage pages, load and save documents, export PDF, and trigger AI generation.
SuperPrint expose une API de script sur l'objet global window.SuperPrint à l'intérieur de
l'éditeur. Utilisez-la depuis la console du navigateur, depuis un <script> que vous
injectez, ou depuis un outil d'automatisation qui pilote la page. Elle permet de construire des
maquettes par programme : ajouter du texte, des formes et des images, gérer les pages, charger et
enregistrer des documents, exporter en PDF et déclencher la génération par IA.
// Afficher la surface disponible
console.log(Object.keys(window.SuperPrint));
// Un carton d'invitation, en millimètres
SuperPrint.addRect(0, 0, 210, 297, { fill: '#f7f3ec' });
SuperPrint.addRect(20, 20, 170, 6, { fill: '#0c0c0f' });
SuperPrint.addText(20, 40, 'Ouverture le 14 mars', { fontSize: 28, fontWeight: 'bold' });
SuperPrint.addText(20, 70, 'Galerie du Port, 12 quai Sud', { fontSize: 13 });
SuperPrint.exportPDF({ quality: 'hd', colorMode: 'cmyk' });
options: width (mm, default 100), fontSize, fontFamily, fontWeight, fill, textAlign.
options : width (mm, défaut 100), fontSize, fontFamily, fontWeight, fill, textAlign.
SuperPrint.addText(20, 20, 'Titre', { fontSize: 24, fontWeight: 'bold', width: 120 });
options: fill (default #cccccc), stroke, strokeWidth.
options : fill (défaut #cccccc), stroke, strokeWidth.
SuperPrint.addRect(20, 20, 60, 40, { fill: '#1a1a1a', stroke: 'none', strokeWidth: 0 });
options: fill, stroke, strokeWidth. x / y position the centre.
options : fill, stroke, strokeWidth. x / y positionnent le centre.
options: fill, stroke, strokeWidth. rx / ry are the two radii, in mm.
options : fill, stroke, strokeWidth. rx / ry sont les deux rayons, en mm.
options: scaleX, scaleY. Returns a Promise resolving to the created image — await it before measuring or exporting.
options : scaleX, scaleY. Renvoie une promesse résolue avec l'image créée — attendez-la avant de mesurer ou d'exporter.
await SuperPrint.addImage(20, 120, 'photo.jpg', { scaleX: 0.5, scaleY: 0.5 });
Creates a set of layout guides on the current page (columns / rows / gutters).
Crée un jeu de repères de mise en page sur la page courante (colonnes / lignes / gouttières).
Batch text creation — inserts several text blocks in one call, useful for catalogues and lists.
Création de textes en lot — insère plusieurs blocs en un seul appel, pratique pour les catalogues et les listes.
Returns one entry per page: { index, objects, active }.
Renvoie une entrée par page : { index, objects, active }.
Switches the active page. Returns false if the index is out of range.
Change la page active. Renvoie false si l'index est hors limites.
Loads a project from a parsed JSON object (the same structure as the .json export).
Charge un projet depuis un objet JSON déjà analysé (même structure que l'export .json).
Flushes all pages and returns the serialised project object. You can JSON.stringify() it and store it wherever you like.
Synchronise toutes les pages et renvoie l'objet projet sérialisé. Vous pouvez le passer à JSON.stringify() et le stocker où vous voulez.
options: quality (hd = 300 DPI), colorMode (rgb | cmyk). The options pre-set the export dialog, then the export runs.
options : quality (hd = 300 DPI), colorMode (rgb | cmyk). Les options pré-règlent la boîte d'export, puis l'export se lance.
SuperPrint.exportPDF({ quality: 'hd', colorMode: 'cmyk' });
Sends a natural-language prompt to the configured AI engine (SP213) and builds the resulting layout on the canvas. Requires an API key configured in the AI panel.
Envoie une consigne en langage naturel au moteur IA configuré (SP213) et construit la maquette résultante sur le canevas. Nécessite une clé API configurée dans le panneau IA.
SuperPrint.aiGenerate('A4 poster for a jazz festival, deep blue and gold, bold title');
| Method | Méthode | Returns | Renvoie | Purpose | Rôle |
|---|---|---|---|---|---|
| addText(x, y, text, options) | Textbox | Adds a text block | Ajoute un bloc texte | ||
| addRect(x, y, w, h, options) | Rect | Adds a rectangle | Ajoute un rectangle | ||
| addCircle(x, y, r, options) | Circle | Adds a circle | Ajoute un cercle | ||
| addEllipse(x, y, rx, ry, options) | Ellipse | Adds an ellipse | Ajoute une ellipse | ||
| addImage(x, y, url, options) | Promise | Adds an image (async) | Ajoute une image (asynchrone) | ||
| generateGrid(...) | — | Creates layout guides | Crée des repères de mise en page | ||
| bulkText(...) | — | Batch text creation | Création de textes en lot | ||
| getPages() | Array | Lists the pages | Liste les pages | ||
| setPage(i) | Boolean | Switches the active page | Change la page active | ||
| loadProject(json) | — | Loads a project | Charge un projet | ||
| saveProject() | Object | Serialises the project | Sérialise le projet | ||
| exportPDF(options) | — | Exports the PDF | Exporte le PDF | ||
| aiGenerate(prompt) | — | Generates a layout with AI | Génère une maquette par IA |
const products = [
{ nom: 'Vase Kano', prix: '140 EUR', ref: 'VK-014' },
{ nom: 'Coupe Sora', prix: '95 EUR', ref: 'CS-009' },
{ nom: 'Plateau Ito', prix: '180 EUR', ref: 'PI-021' },
{ nom: 'Bougeoir Mei',prix: '65 EUR', ref: 'BM-007' }
];
SuperPrint.addText(15, 18, 'COLLECTION HIVER 2026', { fontSize: 11, fill: '#C7382B' });
SuperPrint.addText(15, 26, 'Objets en pierre et laiton', { fontSize: 30, fontWeight: 'bold' });
products.forEach((p, i) => {
const col = i % 2, row = Math.floor(i / 2);
const x = 15 + col * 92, y = 78 + row * 96;
SuperPrint.addRect(x, y, 88, 56, { fill: '#EFE9DD', stroke: 'none' });
SuperPrint.addText(x, y + 60, p.nom, { fontSize: 14, fontWeight: 'bold' });
SuperPrint.addText(x, y + 68, p.ref, { fontSize: 8 });
SuperPrint.addText(x + 60, y + 60, p.prix, { fontSize: 20, fontWeight: 'bold', fill: '#C7382B' });
});
Combine this with SuperTyPo for type work, the SP213 Studio for AI-first layouts, and the documentation for the interface itself.
À combiner avec SuperTyPo pour le travail typographique, le studio SP213 pour les maquettes pilotées par IA, et la documentation pour l'interface elle-même.