更新pdf
This commit is contained in:
22
src/assets/pdf.worker.min.js
vendored
Normal file
22
src/assets/pdf.worker.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -10,10 +10,16 @@ import ui8A from "../../assets/ui8A.png";
|
||||
import ui8B from "../../assets/ui8B.png";
|
||||
import testPdf from "../../assets/testPdf.pdf";
|
||||
|
||||
// 设置 PDF.js worker - 使用本地文件以支持 Electron 环境
|
||||
// 开发环境:Vite 会从 public 目录提供服务
|
||||
// 生产环境:打包到 dist 目录
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = "/pdf.worker.min.js";
|
||||
// 配置 PDF.js worker
|
||||
// 开发环境:Vite 会从根路径提供 public/pdf.worker.min.js
|
||||
// 生产环境:Electron 需要相对于 index.html 的路径
|
||||
const workerPath = new URL("pdf.worker.min.js", document.baseURI).href;
|
||||
pdfjs.GlobalWorkerOptions.workerSrc = workerPath;
|
||||
|
||||
if (window.electronAPI) {
|
||||
window.electronAPI.log("info", `PDF Worker 路径: ${workerPath}`);
|
||||
window.electronAPI.log("info", `Base URI: ${document.baseURI}`);
|
||||
}
|
||||
|
||||
// 使用本地 PDF 文件进行测试
|
||||
const PDF_URL = testPdf;
|
||||
|
||||
Reference in New Issue
Block a user