{"_id":"pdf-parse-fork","name":"pdf-parse-fork","dist-tags":{"latest":"1.2.0"},"versions":{"1.2.0":{"name":"pdf-parse-fork","version":"1.2.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":"^4.3.4","node-ensure":"^0.0.0"},"devDependencies":{"mocha":"^10.2.0"},"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"},"gitHead":"726214b1f055c8cb6d9421faf16ede0402e3a1d7","_id":"pdf-parse-fork@1.2.0","_nodeVersion":"20.0.0","_npmVersion":"9.6.4","dist":{"integrity":"sha512-ovXkJaTtw8PfLNhBThKHKsZlT6WrCkVKY/QgsDK5GiD/tuL2qzezSlHpEgqHCnq3r/0GOq3NZ+won78KL/dAjQ==","shasum":"74fe45273fc0f7a4adea5b5e353b40b12c4fe2cb","tarball":"https://registry.npmjs.org/pdf-parse-fork/-/pdf-parse-fork-1.2.0.tgz","fileCount":54,"unpackedSize":29287343,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH0o3EzevnefzZmovglu+g+kcgtA78XMiYeCQK5udgkhAiBUuo359nHsaLP630bTwAEF3clG1IeXooEzK5qie4qxCQ=="}]},"_npmUser":{"name":"adhityan","email":"kvadhi@gmail.com"},"directories":{},"maintainers":[{"name":"adhityan","email":"kvadhi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pdf-parse-fork_1.2.0_1688194982500_0.6835180364953197"},"_hasShrinkwrap":false}},"time":{"created":"2023-07-01T07:03:02.499Z","1.2.0":"2023-07-01T07:03:02.871Z","modified":"2023-07-01T07:03:03.156Z"},"maintainers":[{"name":"adhityan","email":"kvadhi@gmail.com"}],"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## Important update\n\nThis repositary is a fork of https://gitlab.com/autokent/pdf-parse. The original is not maintained anymore and has mutliple issues, refer https://gitlab.com/autokent/pdf-parse/-/issues/24. This fork aims to patch these issues and republish the package.\n\n## Similar Packages\n\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\n`npm install pdf-parse-fork`\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\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## Basic Usage - HTTP\n\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)\n\t.then(function (data) {\n\t\t// use data\n\t})\n\t.catch(function (error) {\n\t\t// handle exceptions\n\t});\n```\n\n## Extend\n\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\t//check documents https://mozilla.github.io/pdf.js/\n\tlet render_options = {\n\t\t//replaces all occurrences of whitespace with standard spaces (0x20). The default value is `false`.\n\t\tnormalizeWhitespace: false,\n\t\t//do not attempt to combine same line TextItem's. The default value is `false`.\n\t\tdisableCombineTextItems: false,\n\t};\n\n\treturn pageData.getTextContent(render_options).then(function (textContent) {\n\t\tlet lastY,\n\t\t\ttext = \"\";\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} else {\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\tpagerender: 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\n\t// max page number to parse\n\tmax: 0,\n\n\t//check https://mozilla.github.io/pdf.js/getting_started/\n\tversion: \"v1.10.100\",\n};\n```\n\n### _pagerender_ (callback)\n\nIf you need another format except raw text.\n\n### _max_ (number)\n\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)\n\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\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\n\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\n\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\n\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\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"}