Title: 🖨Printing engine Canonical: https://microi.net/en/doc/system-engine/print-engine.html Page-Modified: 2026-10-12T10:49:46.000Z Source: published HTML document body; page revision is not a capability verification date. # 🖨Printing engine Create print templates online to support multiple print scenarios --- ## 📸Preview image [打印引擎预览: https://file.microi.net/upload/img/csdn/6da046aeb97348f38412c01f51ee4e00.png#pic_center] [在这里插入图片描述: https://file.microi.net/upload/img/csdn/4e9f38b6897c4f258f3ca28a2b6534be.png#pic_center] ## Printing engine - before, my code platform has supported the local production of word export print templates, but it cannot be produced online, and word files need to be exported to the local before printing, because my code print engine was born. - All controls support data source configuration, which can be provided through interface engine (https://microi.blog.csdn.net/article/details/143968454) ## Trial Address Microi code printing engine:https://microi.net/print-engine (https://microi.net/print-engine) Table structure, no matter which way to integrate, if you want to persist, you must prepare a data table, the format is as follows json ``` { Id: '', //打印模板ID Title: '', //模板标题 Number: '', //模板编号 Desc: '', //模板描述 DataApi: '', //数据接口 PageObj: {} //页面json对象,存储自行转字符串 PrintObj: {}, //动态打印对象,存储自行转字符串 } ``` ## npm package integration method super simple, a Vue page is done, it is impossible to find out the page, even the route does not use the App page, it can be integrated into the project through components, it will not pollute the project, and the upgrade and expansion are independent, focusing on one that does not interfere with each other, and the distance produces beauty. npm I microi-printengine@latest It must be a Vue 3 Vite project. You can integrate it into any page. The following code is an integration demo. Expand to view JavaScript code (56 lines) javascript ``` ``` ## IFrame integration method this mode, to put it bluntly, is versatile. it regards the low-code designer as an online tool. it is stateless, does not rely on any front-end and back-end, has high cohesion and low coupling, and can be integrated into any platform. When there are hundreds of custom extension components in time, you can become the overlord and independent product on your own. Platform integration uses Iframe to embed the page designer into your own page and communicate with the parent page through postMessage means. The parent page can obtain the page JSON generated by the designer or pass token to the designer. Data communication using postMessage the parent page (docking platform) sends data to the child page through the postMessage, where token is mainly passed, and the child page (page design engine component) uses window.addEventListener to monitor and receive data javascript ``` //设计引擎调用 methods: { sendMessageToIframe() { const iframe = this.$refs.myIframe; // 要发送的数据 const dataToSend = { printEngineToken: "token 值" }; // 使用 postMessage 发送数据给 iframe iframe.contentWindow.postMessage(dataToSend, "*"); } } ``` ## Vue3 combined integrated demo Expand to view the JavaScript code (107 lines) javascript ``` ```