优化样式 新增版本号
This commit is contained in:
@@ -7,9 +7,9 @@ electron.app.whenReady().then(() => {
|
||||
width: 1024,
|
||||
height: 768,
|
||||
fullscreenable: true,
|
||||
fullscreen: false,
|
||||
fullscreen: process.env.VITE_DEV_SERVER_URL ? false : true,
|
||||
simpleFullscreen: true,
|
||||
frame: true,
|
||||
frame: process.env.VITE_DEV_SERVER_URL ? true : false,
|
||||
webPreferences: {
|
||||
// 集成网页和 Node.js,也就是在渲染进程中,可以调用 Node.js 方法
|
||||
nodeIntegration: true,
|
||||
@@ -31,6 +31,7 @@ electron.app.whenReady().then(() => {
|
||||
});
|
||||
const printWin = new electron.BrowserWindow({
|
||||
show: false,
|
||||
width: 580,
|
||||
webPreferences: {
|
||||
// 集成网页和 Node.js,也就是在渲染进程中,可以调用 Node.js 方法
|
||||
nodeIntegration: true,
|
||||
@@ -42,15 +43,16 @@ electron.app.whenReady().then(() => {
|
||||
} else {
|
||||
printWin.loadFile(path.resolve(__dirname, "../dist/print.html"));
|
||||
}
|
||||
printWin.webContents.openDevTools();
|
||||
electron.ipcMain.on("printerInfoSync", (event, params) => {
|
||||
console.log(JSON.parse(params));
|
||||
printWin.webContents.send("getParams", params);
|
||||
});
|
||||
electron.ipcMain.on("printStart", () => {
|
||||
console.log("开始打印");
|
||||
printWin.webContents.print({
|
||||
silent: true
|
||||
printWin.webContents.printToPDF({}, (error, data) => {
|
||||
if (!error && data) {
|
||||
console.log("成功生成PDF");
|
||||
} else {
|
||||
console.error("无法生成PDF", error);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user