Getting links to print files
- Less than a minute to read
When the user finishes validation of their files, they click the Finish button in the navigation area, and the Preflight Tool renders these files to the high-resolution PDF file.
To get links to the resulting files, you must create and initialize an e-commerce driver and subscribe to the onSubmitted event. This event is triggered when the user finishes editing. On the front end, you can log these links as follows:
// Initialize the e-commerce driver and display the editor in the container.
const ecommerce = await driver.init(product, editor, config, settings, null, quantity, user);
ecommerce.products.current.renderEditor(document.getElementById("editor-parent"));
// Subscribe to the onSubmitted event.
ecommerce.cart.onSubmitted.subscribe(data => {
data.lineItems.forEach(function(order) {
console.log("Print files: ", order.downloadUrls);
console.log("Previews: ", order.images);
});
});
If you refer to the sample page, you can see that the ecommerce
object is initialized before loading the editor. We can also use this object to connect to the event of clicking the Finish button.