Merge branch 'main' of https://git.ambigrat.com/hom/yuanhe-checkin-electron
This commit is contained in:
@@ -300,16 +300,18 @@ ipcMain.handle("print-pdf", async (event, pdfDataOrUrl, printOptions = {}) => {
|
||||
throw new Error(`PDF文件大小异常(${stats.size} bytes),可能文件损坏`);
|
||||
}
|
||||
|
||||
const duplexMode = printOptions?.duplex;
|
||||
log.info(
|
||||
`准备打印PDF: ${pdfFilePath}, 打印机: ${
|
||||
targetPrinterName || "默认打印机"
|
||||
}`
|
||||
}, 双面打印: ${duplexMode ? "是" : "否"}`
|
||||
);
|
||||
|
||||
// 使用 pdf-to-printer 打印
|
||||
const printOptions_ptp = {
|
||||
printer: targetPrinterName || undefined,
|
||||
silent: true, // 静默打印
|
||||
duplex: duplexMode || false, // 双面打印选项
|
||||
};
|
||||
|
||||
await ptp.print(pdfFilePath, printOptions_ptp);
|
||||
|
||||
Reference in New Issue
Block a user