Я хочу преобразовать данные файла PDF в формат JSON. Я хочу вывод текста в правильном формате JSON, но мой код преобразует обычный JSON. что для этого используется? и npm
библиотека pdf-parse
не дает правильного формата и pdf2json
также.
var fs=require('fs');
const pdf = require('pdf-parse');
module.exports.simplePdfUpload= (req, res) => {
upload(req, res, (err) => {
let dataBuffer = fs.readFileSync(req.files[0].path);
pdf(dataBuffer).then(function(data) {
res.send({"jsondata":data,})
})
.catch(function(error){
})
})
}
ВЫХОД-
{
'waters including interstate wetlands; (3) all other waters such as ' +
'intrastate lakes, rivers, streams (including intermittent \nstreams), ' +
'mudflats, sandflats, wetlands, sloughs, prairie potholes, wet ' +
'meadows, playa lakes, or natural ponds, etc., which the use, \n' +
'degradation, or destruction could affect interstate/ foreign commerce; (4) ' +
'all impoundments of waters otherwise defined as waters of the U. S., \n(5) ' +
'tributaries of waters identified in 1 through 4 above; (6) the territorial ' +
'seas; and (7) wetlands adjacent to waters identified in 1 through 6 \n' +
'above. Only the USACE has the authority to make a final wetlands ' +
'jurisdictional determination. \n ',
version: '1.10.100'
}
Но я хочу вывести этот тип
{
"Info":
{
"Company": "ABC",
"Team": "node"
},
"Number of members": 4,
"Time to finish": "1 day"
}