{"_id":"@bakedpotatolord/pdf-parse","name":"@bakedpotatolord/pdf-parse","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bakedpotatolord/pdf-parse","version":"1.0.0","description":"Pure javascript cross-platform module to extract text from PDFs.","main":"index.js","keywords":["pdf-parse","pdf-crawler","xpdf","pdf.js","pdfreader","pdf-extractor","pdf2json","j-pdfjson","pdf-parser","pdf-extract","pdf-extractor","pdf-to-text","pdf-text-extract","pdfjs","server side PDF parsing","pdf metadata"],"dependencies":{"debug":"^3.1.0","node-ensure":"^0.0.0"},"devDependencies":{"mocha":"^4.0.1"},"scripts":{"test":"node node_modules/mocha/bin/_mocha --recursive --slow 10000","start":"node index.js"},"homepage":"https://gitlab.com/autokent/pdf-parse","bugs":{"url":"https://gitlab.com/autokent/pdf-parse/issues","email":"mehmet.kozan@live.com"},"repository":{"type":"git","url":"git+https://gitlab.com/autokent/pdf-parse.git"},"author":{"name":"Mehmet Kozan","email":"mehmet.kozan@live.com"},"license":"MIT","engines":{"node":">=6.8.1"},"_id":"@bakedpotatolord/pdf-parse@1.0.0","gitHead":"62789642da7351c528966e82c7f127d74f360ef1","_nodeVersion":"20.8.0","_npmVersion":"10.1.0","dist":{"integrity":"sha512-BKez1b9V8kAkCP4bNHsYofc5w6TKjZB2wdT6XoxVspwZi7qxyeKBsKLWPSiGL9a2IdQn1IjluM38IbBEZurloA==","shasum":"202e65a160a6847e82a912cd495c65bcd7bfa61d","tarball":"https://registry.npmjs.org/@bakedpotatolord/pdf-parse/-/pdf-parse-1.0.0.tgz","fileCount":50,"unpackedSize":29159491,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQClFGo5isjEO+ERUkbrxpKVoZ2JmLSx9umuBEMqFBmeUwIgIK7e1bYT4uz8zwX9dNxcQoLuJH06SqhRfw4qwMSwjYw="}]},"_npmUser":{"name":"bakedpotatolord","email":"918780@dpsk12.net"},"directories":{},"maintainers":[{"name":"bakedpotatolord","email":"918780@dpsk12.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pdf-parse_1.0.0_1705123249885_0.7150638578661568"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-13T05:20:49.748Z","1.0.0":"2024-01-13T05:20:50.292Z","modified":"2024-01-13T05:20:50.537Z"},"maintainers":[{"name":"bakedpotatolord","email":"918780@dpsk12.net"}],"description":"Pure javascript cross-platform module to extract text from PDFs.","homepage":"https://gitlab.com/autokent/pdf-parse","keywords":["pdf-parse","pdf-crawler","xpdf","pdf.js","pdfreader","pdf-extractor","pdf2json","j-pdfjson","pdf-parser","pdf-extract","pdf-extractor","pdf-to-text","pdf-text-extract","pdfjs","server side PDF parsing","pdf metadata"],"repository":{"type":"git","url":"git+https://gitlab.com/autokent/pdf-parse.git"},"author":{"name":"Mehmet Kozan","email":"mehmet.kozan@live.com"},"bugs":{"url":"https://gitlab.com/autokent/pdf-parse/issues","email":"mehmet.kozan@live.com"},"license":"MIT","readme":"# pdf-parse\n\n**Pure javascript cross-platform module to extract texts from PDFs.**\n\n[![version](https://img.shields.io/npm/v/pdf-parse.svg)](https://www.npmjs.org/package/pdf-parse)\n[![downloads](https://img.shields.io/npm/dt/pdf-parse.svg)](https://www.npmjs.org/package/pdf-parse)\n[![node](https://img.shields.io/node/v/pdf-parse.svg)](https://nodejs.org/)\n[![status](https://gitlab.com/autokent/pdf-parse/badges/master/pipeline.svg)](https://gitlab.com/autokent/pdf-parse/pipelines)\n\n## Similar Packages\n* [pdf2json](https://www.npmjs.com/package/pdf2json) buggy, no support anymore, memory leak, throws non-catchable fatal errors\n* [j-pdfjson](https://www.npmjs.com/package/j-pdfjson) fork of pdf2json\n* [pdf-parser](https://github.com/dunso/pdf-parse) buggy, no tests\n* [pdfreader](https://www.npmjs.com/package/pdfreader) using pdf2json\n* [pdf-extract](https://www.npmjs.com/package/pdf-extract) not cross-platform using xpdf\n\n## Installation\n`npm install pdf-parse`\n \n## Basic Usage - Local Files\n\n```js\nconst fs = require('fs');\nconst pdf = require('pdf-parse');\n\nlet dataBuffer = fs.readFileSync('path to PDF file...');\n\npdf(dataBuffer).then(function(data) {\n\n\t// number of pages\n\tconsole.log(data.numpages);\n\t// number of rendered pages\n\tconsole.log(data.numrender);\n\t// PDF info\n\tconsole.log(data.info);\n\t// PDF metadata\n\tconsole.log(data.metadata); \n\t// PDF.js version\n\t// check https://mozilla.github.io/pdf.js/getting_started/\n\tconsole.log(data.version);\n\t// PDF text\n\tconsole.log(data.text); \n        \n});\n```\n\n## Basic Usage - HTTP\nYou can use [crawler-request](https://www.npmjs.com/package/crawler-request) which uses the `pdf-parse`\n\n## Exception Handling\n\n```js\nconst fs = require('fs');\nconst pdf = require('pdf-parse');\n\nlet dataBuffer = fs.readFileSync('path to PDF file...');\n\npdf(dataBuffer).then(function(data) {\n\t// use data\n})\n.catch(function(error){\n\t// handle exceptions\n})\n```\n\n## Extend\n* v1.0.9 and above break pagerender callback [changelog](https://gitlab.com/autokent/pdf-parse/blob/master/CHANGELOG)\n* If you need another format like json, you can change page render behaviour with a callback\n* Check out https://mozilla.github.io/pdf.js/\n\n```js\n// default render callback\nfunction render_page(pageData) {\n    //check documents https://mozilla.github.io/pdf.js/\n    let render_options = {\n        //replaces all occurrences of whitespace with standard spaces (0x20). The default value is `false`.\n        normalizeWhitespace: false,\n        //do not attempt to combine same line TextItem's. The default value is `false`.\n        disableCombineTextItems: false\n    }\n\n    return pageData.getTextContent(render_options)\n\t.then(function(textContent) {\n\t\tlet lastY, text = '';\n\t\tfor (let item of textContent.items) {\n\t\t\tif (lastY == item.transform[5] || !lastY){\n\t\t\t\ttext += item.str;\n\t\t\t}  \n\t\t\telse{\n\t\t\t\ttext += '\\n' + item.str;\n\t\t\t}    \n\t\t\tlastY = item.transform[5];\n\t\t}\n\t\treturn text;\n\t});\n}\n\nlet options = {\n    pagerender: render_page\n}\n\nlet dataBuffer = fs.readFileSync('path to PDF file...');\n\npdf(dataBuffer,options).then(function(data) {\n\t//use new format\n});\n```\n\n## Options\n\n```js\nconst DEFAULT_OPTIONS = {\n\t// internal page parser callback\n\t// you can set this option, if you need another format except raw text\n\tpagerender: render_page,\n\t\n\t// max page number to parse\n\tmax: 0,\n\t\n\t//check https://mozilla.github.io/pdf.js/getting_started/\n\tversion: 'v1.10.100'\n}\n```\n### *pagerender* (callback)\nIf you need another format except raw text.  \n\n### *max* (number)\nMax number of page to parse. If the value is less than or equal to 0, parser renders all pages.  \n\n### *version* (string, pdf.js version)\ncheck [pdf.js](https://mozilla.github.io/pdf.js/getting_started/)\n\n* `'default'`\n* `'v1.9.426'`\n* `'v1.10.100'`\n* `'v1.10.88'`\n* `'v2.0.550'`\n\n>*default* version is *v1.10.100*   \n>[mozilla.github.io/pdf.js](https://mozilla.github.io/pdf.js/getting_started/#download)\n\n## Test\n* `mocha` or `npm test`\n* Check [test folder](https://gitlab.com/autokent/pdf-parse/tree/master/test) and [quickstart.js](https://gitlab.com/autokent/pdf-parse/blob/master/quickstart.js) for extra usages.\n\n## Support\nI use this package actively myself, so it has my top priority. You can chat on WhatsApp about any infos, ideas and suggestions.\n\n[![WhatsApp](https://img.shields.io/badge/style-chat-green.svg?style=flat&label=whatsapp)](https://api.whatsapp.com/send?phone=905063042480&text=Hi%2C%0ALet%27s%20talk%20about%20pdf-parse)\n\n### Submitting an Issue\nIf you find a bug or a mistake, you can help by submitting an issue to [GitLab Repository](https://gitlab.com/autokent/pdf-parse/issues)\n\n### Creating a Merge Request\nGitLab calls it merge request instead of pull request.  \n\n* [A Guide for First-Timers](https://about.gitlab.com/2016/06/16/fearless-contribution-a-guide-for-first-timers/)\n* [How to create a merge request](https://docs.gitlab.com/ee/gitlab-basics/add-merge-request.html)\n* Check [Contributing Guide](https://gitlab.com/autokent/pdf-parse/blob/master/CONTRIBUTING.md) \n\n## License\n[MIT licensed](https://gitlab.com/autokent/pdf-parse/blob/master/LICENSE) and all it's dependencies are MIT or BSD licensed.\n","readmeFilename":"README.md"}