最近小弟在做一个功能
是将 pdf 跟 xslx 档案转为 json 在 electron 包好的原生桌面版使用
框架层主要是用 vue-cli3 脚手架搭配 vue-cli-electron-builder
处理文件用的依赖则是 pdf2json 跟 xslx-style
在处理pdf时遇到无法引入依赖的问题, 直接下代码
in App.vue
const PDF2json = require('electron').remote.require('pdf2json')
const pdfParser = new PDF2json()
pdfParser.on('pdfParser_dataReady', pdfData => {
// 處理資料
})
pdfParser.loadPDF('./documents/input.pdf')
会出现 ENOENT 找不到档案
也试过ipcMain, ipcRenderer 但追根究柢还是无法引入 pdf2json 包
vue.config.js 中的webpack配置都是预设的,
不知道是不是webpack打包过后丢失了pdf2json档案...
想请问大家有遇过类似的问题吗? 或有相关的思路吗 ?