Skip to content

Examples ​

The TronDesigner integration examples are small, runnable HTML pages, each showing one integration technique against the live editor. The source is on GitHub.

All examples ​

Each title opens the live example; Source opens its HTML on GitHub.

ExampleWhat it showsExplained inSource
Quick StartAuto-opens the designer on page load using exact data.Quick startsource
Attributes - OverviewOpens the editor from data attributes on a button and wires every event callback through script attributes.HTML data attributes, Data attributes referencesource
Init Failure HandlingHandles an initialization failure of the script with a notification popup.Loading the integration script, Debugging and error handlingsource
Builder - ExactUses the JavaScript builder for an exact product and printing.JavaScript builder API, Data modessource
Builder - PartialStarts with a product model; the customer picks variants and printings.JavaScript builder API, Data modessource
JSON - ExactOpens the editor with a full, explicit JSON payload.Editor arguments, Data modessource
JSON - Exact (Advanced)Adds and removes product variants and printings on an existing print job in Edit mode.Open modes, Editor argumentssource
Editor Options - MissingHow showSelectedVariants / showSelectedPrintOptions react when the variant or printing codes you send aren't in the catalog.Editor argumentssource
JSON - PartialOpens the editor with a minimal JSON payload (model only).Data modes, Editor argumentssource
JSON - Own ProductUses your own product data (Own mode) instead of the TronCloud catalog.Data modes, Integration recipessource
Get ImagesRetrieves the motive image and the product visualization after a print job is created.Retrieving print jobs and filessource
Result ActionWhat happens when the customer confirms the print graphics: nothing, close, or a dialog.Result actionssource
Custom Editor ButtonsOpens the editor with one, two or three custom footer buttons.Custom editor buttonssource
Edit ModeOpens and modifies an existing print job by its GUID.Open modessource
View ModeShows a print job read-only for review and confirmation.Open modessource
URL IntegrationOpens the editor from a plain URL, without JavaScript — for e-mails and QR codes.Integration via URLsource
Inline EmbedEmbeds the editor into an element of your page instead of a dialog.Dialog and inline displaysource
Event HandlingSubscribes to all editor events and logs the print job, logo, text and proofreading changes.Events and callbackssource
Session TrackingLinks print jobs to your customers, orders and cart items.Customers and orderssource
Custom PropertiesAttaches your own key/value metadata to a print job (attribute, builder or JSON) and reads it back from the created event.Custom propertiessource
Error HandlingWhere errors are reported and how to handle them: onClose('Error'), getInitialized(), invalid custom buttons and rejected API calls.Debugging and error handlingsource
Multiple PrintingsSeveral print positions and technologies in one print job.JavaScript builder API, Editor argumentssource
Modify styles from hostInjects custom CSS from the host page to change the editor's appearance.Styling the editorsource
Logo FeaturesLogo upload and gallery, preselecting a logo by GUID or URL, and logo events.Logossource
Logo VisualizationReplaces product images with rendered logo visualizations (data-td-action="RenderVisualization"), by variant or by variant + print position + technology.Logo visualizationssource

Run the examples locally ​

You need an active TronDesigner license, a website integration API key (Admin Portal → Settings → API Keys) whose allowed domains include localhost (a development key, not your production one — see Allowed domains), and Node.js 20+ with npm. Docker is optional.

The small Express server in src/ serves the pages and replaces the {TD_URL}, {TD_URL_INTEGRATION} and {TD_API_KEY} placeholders in them with these environment variables (all three are required):

VariableProductionDevelopment
TD_URLhttps://app.trondesigner.comhttps://app-dev.trondesigner.com
TD_URL_INTEGRATIONhttps://integration.trondesigner.comhttps://integration-dev.trondesigner.com
TD_API_KEYyour production website keyyour development website key
bash
git clone https://github.com/PromoTron/trondesigner-examples.git
cd trondesigner-examples/src
# create src/.env with TD_URL, TD_URL_INTEGRATION and TD_API_KEY (loaded via dotenv)
npm ci
npm run run
# → http://localhost:3000 (set PORT to change it)
bash
cd trondesigner-examples/src
docker build -t trondesigner-examples .
docker run --rm -p 3000:3000 \
  -e TD_URL=https://app.trondesigner.com \
  -e TD_URL_INTEGRATION=https://integration.trondesigner.com \
  -e TD_API_KEY=<YOUR_API_KEY> \
  trondesigner-examples

The repository also contains a Docker Compose setup in deployments/docker/.

Not covered by an example yet ​

These features are documented in the guides but have no runnable example yet:

  • Integration via URL: the signed-token link (token=, created with the REST API) and the URL-encoded JSON form (options=) — see Integration via URL.
  • Customers: setCustomer() / getCustomer() and the data-td-customer-* script attributes — see Customers and orders.
  • Builder methods: the Own-mode builder (setOwnEmptyProduct, setOwnProductSingleVariant, setOwnProductSingleDimension, setOwnProductTwoDimensions, addOwnPrinting), addExactPrintings(), addCustomProperty() / addCustomProperties(), setResultActionNone() / setResultActionCloseEditor() / setResultActionShowDialog(), setDataMode() / setEditorOptions(), and setPrintJob() (shown only as a code listing in JSON - Exact (Advanced)) — see JavaScript builder API.
  • Script state and debugging: getInitialized() / getInitializing(), setLogLevel() and data-td-log-level, data-td-monitored-element-id / subscribeElementChanges() — see Debugging and error handling.
  • Other methods: openSinglePrintTaskDesigner(), getProofreading(), clonePrintJob().
  • Editor arguments: editorOptions.showQuantityInputs and alwaysShowImageSelect, and a single data-td-options attribute with the full JSON — see Editor arguments.
  • Server side: receiving and verifying webhooks and calling the REST API.

See also ​

Czech Republic – The Country for the FutureFunded by the European Union – NextGenerationEUThe project was implemented within the The Country for the Future programme of the Ministry of Industry and Trade and co-financed by the European Union under NextGenerationEU.Support · Examples

Czech Republic – The Country for the FutureFunded by the European Union – NextGenerationEUThe project was implemented within the The Country for the Future programme of the Ministry of Industry and Trade and co-financed by the European Union under NextGenerationEU.Support · Examples