首页 > 解决方案 > 从 npm 使用 tabula-js 时如何修复错误?

问题描述

您好,我正在尝试使用 npm tabula-js 从 pdf 中提取数据,当我运行此示例代码时,出现下一个错误

null Error: Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract!
    at consumer (C:\Users\EQUIPO\Desktop\extract-data-pdf-pancho\node_modules\highland-process\lib\process.js:56:14)       
    at Stream.s._send (C:\Users\EQUIPO\Desktop\extract-data-pdf-pancho\node_modules\highland\lib\index.js:1560:9)
    at Stream.write (C:\Users\EQUIPO\Desktop\extract-data-pdf-pancho\node_modules\highland\lib\index.js:1661:18)
    at Stream._send (C:\Users\EQUIPO\Desktop\extract-data-pdf-pancho\node_modules\highland\lib\index.js:984:26)
    at Stream.write (C:\Users\EQUIPO\Desktop\extract-data-pdf-pancho\node_modules\highland\lib\index.js:1661:18)
    at Socket.ondata (internal/streams/readable.js:719:22)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readablethi.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)

这是我的代码

const tabula = require('tabula-js');
const t = tabula('testdoc1.pdf');
t.extractCsv((err, data) => console.log(data,err));

标签: node.jsnpmtabula

解决方案


推荐阅读