From 7eca0e9bf13657379e0affcda1f63bfdd1beeb47 Mon Sep 17 00:00:00 2001 From: xianyi Date: Thu, 11 Dec 2025 15:16:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=8C=E9=9D=A2=E6=89=93?= =?UTF-8?q?=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/main.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/electron/main.js b/electron/main.js index 7bcde9f..3a64fe1 100644 --- a/electron/main.js +++ b/electron/main.js @@ -301,9 +301,11 @@ ipcMain.handle("print-pdf", async (event, pdfDataOrUrl, printOptions = {}) => { } const duplexMode = printOptions?.duplex; + // pdf-to-printer 使用 side 选项,而不是 duplex + // side 可选值: "simplex" | "duplex" | "duplexshort" | "duplexlong" + const sideOption = duplexMode ? "duplex" : "simplex"; log.info( - `准备打印PDF: ${pdfFilePath}, 打印机: ${ - targetPrinterName || "默认打印机" + `准备打印PDF: ${pdfFilePath}, 打印机: ${targetPrinterName || "默认打印机" }, 双面打印: ${duplexMode ? "是" : "否"}` ); @@ -311,7 +313,7 @@ ipcMain.handle("print-pdf", async (event, pdfDataOrUrl, printOptions = {}) => { const printOptions_ptp = { printer: targetPrinterName || undefined, silent: true, // 静默打印 - duplex: duplexMode || false, // 双面打印选项 + side: sideOption, // 双面打印选项 }; await ptp.print(pdfFilePath, printOptions_ptp);