
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
The pdf-parser is a parser of PDF content and layout information with pdf.js.
To get a local copy of the current code, clone it using git:
$ git clone https://github.com/dunso/pdf-parser.git
$ cd pdf-parser
Next, install Node.js via the official package or via nvm.
install all dependencies for pdf-parser:
$ npm install
The example is in the file example/node/pdf2json.js.
If you are in the root directory, you can use node example/node/pdf2json to run the example.
Or you can cd example/node and then node pdf2json.
var pdfParser = require('pdf-parser');
var PDF_PATH = 'test.pdf';
pdfParser.pdf2json(PDF_PATH, function (error, pdf) {
if(error != null){
console.log(error);
}else{
console.log(JSON.stringify(pdf));
}
});
The tool can convert pdf to json as bellow:
{
"pages":[
{
"width":612,
"height":792,
"pageId":0,
"texts":[
{
"text":"Hello World",
"direction":"ltr", //from left to right
"width":52.81644000000001,
"height":27.96,
"top":278.69,
"left":296.81,
"transform":[27.96,0,0,27.96,296.81,278.69],
"fontSize":27.96,
"fontName":"Times",
"fontOriginName":"TimesNewRomanPSMT",
"bold":false,
"italic":false,
"black":false,
"color":"[68,113,196]"
}
]
}
]
}
The usage of how to call the pdf-parser in java : java-pdf-parser
File an issue:
FAQs
Convert PDF content and layout information with pdf.js
The npm package pdf-parser receives a total of 3,426 weekly downloads. As such, pdf-parser popularity was classified as popular.
We found that pdf-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.