Created
May 25, 2018 20:38
-
-
Save guaracyalima/25618a878e2363ad19a84da5d92a7cd6 to your computer and use it in GitHub Desktop.
A porra da transfocamao em PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require('path') | |
var fs = require('fs'); | |
var findInFiles = require('find-in-files'); | |
var filePath = path.join(__dirname, './file.pdf') | |
var extract = require('pdf-text-extract') | |
extract(filePath, function (err, pages) { | |
if (err) { | |
console.dir(err) | |
return | |
} | |
fs.writeFile("./output.txt", pages, function(err) { | |
if(err) { | |
return console.log(err); | |
} | |
}); | |
pages = JSON.stringify(pages) | |
const start = pages.search("Segurado: "); | |
const end = pages.search("Segurado: ") | |
console.log('start', start); | |
console.log('end', end); | |
console.log('retorno', pages.substr(start, end)) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "extractor", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "Guaracy A Lima <guaracyaraujolima@gmail.com> (http://guabirabadev.github.io/)", | |
"license": "MIT", | |
"dependencies": { | |
"find-in-files": "^0.5.0", | |
"pdf-extract": "^1.0.11", | |
"pdf-text-extract": "^1.5.0", | |
"pdf2json": "^1.1.7" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment