修复打印

This commit is contained in:
xianyi
2025-11-21 10:36:00 +08:00
parent 196669c013
commit b954b927db
2 changed files with 79 additions and 26 deletions

View File

@@ -66,9 +66,15 @@ const UI8: React.FC = () => {
return;
}
if (!pdfData) {
alert("PDF 尚未加载完成,请稍候");
return;
}
setIsPrinting(true);
try {
const result = await window.electronAPI.printPdf(PDF_URL);
// 使用已加载的 PDF 数据base64避免重复下载
const result = await window.electronAPI.printPdf(pdfData);
if (!result.success) {
alert(`打印失败: ${result.error || "未知错误"}`);
}