当前位置:网站首页>JS教程之使用 ElectronJS 桌面应用程序打印贴纸/标签
JS教程之使用 ElectronJS 桌面应用程序打印贴纸/标签
2022-06-26 15:54:00 【知识大胖】
在本文中,我们将讨论如何使用 Vue-ElectronJS 桌面应用程序打印特定尺寸(比如 10" X 10")的贴纸
我们看到产品信息标签贴在产品上,并附有产品和价格信息。或者有许多行业正在对产品进行测试,测试应用程序会根据其结果创建一个贴纸,并将该贴纸贴在被测产品上。
这些印刷品是如何生成并打印在贴纸上的?
我们将在本文中看到这一点。
我们正在使用带有 ElectronJS 的 VueJS 来构建我们的应用程序。由于 ElectronJS 使我们能够创建桌面应用程序,它还具有用于创建打印语句并返回其结果的内置 API。
打印普通文本 VS 打印 HTML 内容
当你想打印普通文本时,你可以直接从主窗口给出命令。但是,当您想要打印自定义 HTML 设计的内容时,您必须创建一个新窗口,您将在其中呈现 HTML 内容,然后发出命令以在此页面上打印内容。
在本文中,我们将探讨打印 HTML 内容的第二种选择。
默认情况下,ElectronJS 创建一个单独的窗口,当您想要呈现应用程序内容时它就足够了,但是当我们想要打印自定义/动态数据时,我们必须有另一个窗口来呈现这些数据。
让我们配置另一个窗口:
在你的主渲染器文件中,通常位于–src/main/index.js,你会注意到这里定义了主窗口,让我们定义另一个窗口来渲染打印内容
const printerWindow = new BrowserWindow({
show: false,
webPreferences: {
webSecurity: false,
nodeIntegratio边栏推荐
- NFT 平台安全指南(2)
- Transaction input data of Ethereum
- Solidus labs welcomes zhaojiali, former head of financial innovation in Hong Kong, as a strategic adviser
- JVM笔记
- 6 custom layer
- SAP OData development tutorial - from getting started to improving (including segw, rap and CDP)
- Common properties of XOR and addition
- Nanopi duo2 connection WiFi
- 基于 MATLAB的自然过渡配音处理方案探究
- 补齐短板-开源IM项目OpenIM关于初始化/登录/好友接口文档介绍
猜你喜欢

Summary of data interface API used in word search and translation applications

Canvas three dot flashing animation

js文本滚动分散动画js特效

5000字解析:实战化场景下的容器安全攻防之道

10 tf. data

(1) Keras handwritten numeral recognition and recognition of self written numbers

STEPN 新手入门及进阶

How to identify contractual issues

svg环绕地球动画js特效

This year, the AI score of college entrance examination English is 134. The research of Fudan Wuda alumni is interesting
随机推荐
Unlock the value of data fusion! Tencent angel powerfl won the "leading scientific and Technological Achievement Award" at the 2021 digital Expo
SAP OData development tutorial - from getting started to improving (including segw, rap and CDP)
Development, deployment and online process of NFT project (2)
Leetcode one week race 298, first three questions
Practice of federal learning in Tencent micro vision advertising
「幹貨」NFT 上中下遊產業鏈全景分析
Cookie和Session详解
NFT 项目的开发、部署、上线的流程(1)
若依微服务特殊字符串被过滤的解决办法
股票开户优惠链接,我如何才能得到?在线开户安全么?
[time complexity and space complexity]
R language generalized linear model function GLM, GLM function to build logistic regression model, analyze whether the model is over discrete, and use the ratio of residual deviation and residual degr
TweenMax+SVG切换颜色动画场景
NFT contract basic knowledge explanation
C. Inversion Graph
Failed to get convolution algorithm. This is probably because cuDNN failed to initialize
This year, the AI score of college entrance examination English is 134. The research of Fudan Wuda alumni is interesting
Common properties of XOR and addition
【leetcode】48. Rotate image
Transformation of zero knowledge QAP problem