默认打印机

This commit is contained in:
xianyi
2025-11-27 15:35:36 +08:00
parent b192e1bae9
commit 86efd6281a
3 changed files with 56 additions and 10 deletions

19
src/electron.d.ts vendored
View File

@@ -1,9 +1,26 @@
// Electron API 类型声明
interface ElectronPrinterInfo {
name: string;
displayName?: string;
description?: string;
status?: number;
isDefault?: boolean;
options?: Record<string, string>;
}
interface ElectronAPI {
fetchPdf: (
pdfUrl: string
) => Promise<{ success: boolean; data?: string; error?: string }>;
printPdf: (pdfUrl: string) => Promise<{ success: boolean; error?: string }>;
printPdf: (
pdfUrl: string,
options?: { printerName?: string }
) => Promise<{ success: boolean; error?: string }>;
getPrinters: () => Promise<{
success: boolean;
printers?: ElectronPrinterInfo[];
error?: string;
}>;
startIdCardListen: () => Promise<any>;
stopIdCardListen: () => Promise<any>;
onIdCardData: (callback: (data: any) => void) => void;