ganze project
This commit is contained in:
23
extract_pdf.js
Normal file
23
extract_pdf.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const fs = require('fs');
|
||||
const pdf = require('pdf-parse');
|
||||
|
||||
console.log('Type of pdf:', typeof pdf);
|
||||
console.log('pdf export:', pdf);
|
||||
|
||||
let dataBuffer = fs.readFileSync('Informationen.pdf');
|
||||
|
||||
try {
|
||||
if (typeof pdf === 'function') {
|
||||
pdf(dataBuffer).then(function(data) {
|
||||
console.log(data.text);
|
||||
});
|
||||
} else if (pdf.default && typeof pdf.default === 'function') {
|
||||
pdf.default(dataBuffer).then(function(data) {
|
||||
console.log(data.text);
|
||||
});
|
||||
} else {
|
||||
console.log('Cannot find pdf function');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
Reference in New Issue
Block a user