{"id":28146329,"url":"https://github.com/yakovmeister/pdf2image","last_synced_at":"2026-06-08T01:07:30.005Z","repository":{"id":43002355,"uuid":"106502032","full_name":"yakovmeister/pdf2image","owner":"yakovmeister","description":"A utility for converting pdf to image and base64 format.","archived":false,"fork":false,"pushed_at":"2025-05-31T01:56:13.000Z","size":45378,"stargazers_count":502,"open_issues_count":25,"forks_count":154,"subscribers_count":7,"default_branch":"master","last_synced_at":"2026-03-10T18:32:25.061Z","etag":null,"topics":["graphicsmagick","node-pdf","node-pdf-to-image","node-pdf2img","pdf","pdf-to-image"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yakovmeister.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-10-11T03:40:03.000Z","updated_at":"2026-03-06T01:38:14.000Z","dependencies_parsed_at":"2024-06-18T12:30:45.085Z","dependency_job_id":"5b9b5921-6928-422a-84f7-e25a5926047c","html_url":"https://github.com/yakovmeister/pdf2image","commit_stats":{"total_commits":175,"total_committers":19,"mean_commits":9.210526315789474,"dds":0.6857142857142857,"last_synced_commit":"4e172f635b724b09bfb7c34e48d3a6d975c24edf"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/yakovmeister/pdf2image","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovmeister%2Fpdf2image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovmeister%2Fpdf2image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovmeister%2Fpdf2image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovmeister%2Fpdf2image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yakovmeister","download_url":"https://codeload.github.com/yakovmeister/pdf2image/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yakovmeister%2Fpdf2image/sbom","scorecard":{"id":1242008,"data":{"date":"2026-01-12","repo":{"name":"github.com/yakovmeister/pdf2image","commit":"fe7f8f1a6bbbb8f7e0992f3e98be34ae7532aa32"},"scorecard":{"version":"v5.4.1-0.20260109214540-85483c21ffbb","commit":"85483c21ffbb0f125cf1d16aa53f283d574f4ca5"},"score":4.5,"checks":[{"name":"Code-Review","score":3,"reason":"Found 9/26 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lint.yml:1","Warn: no topLevel permission defined: .github/workflows/npm-publish.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#fuzzing"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/npm-publish.yml:8"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#branch-protection"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/yakovmeister/pdf2image/lint.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/yakovmeister/pdf2image/lint.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/yakovmeister/pdf2image/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/npm-publish.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/yakovmeister/pdf2image/npm-publish.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/yakovmeister/pdf2image/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/yakovmeister/pdf2image/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:39: update your workflow using https://app.stepsecurity.io/secureworkflow/yakovmeister/pdf2image/test.yml/master?enable=pin","Warn: containerImage not pinned by hash: examples/docker/Dockerfile:1: pin your Docker image by updating node:20.9.0-alpine3.18 to node:20.9.0-alpine3.18@sha256:cb2301e2c5fe3165ba2616591efe53b4b6223849ac0871c138f56d5f7ae8be4b","Warn: npmCommand not pinned by hash: examples/docker/Dockerfile:8","Warn: npmCommand not pinned by hash: .github/workflows/lint.yml:20","Warn: npmCommand not pinned by hash: .github/workflows/npm-publish.yml:20","Warn: npmCommand not pinned by hash: .github/workflows/test.yml:30","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of   4 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/85483c21ffbb0f125cf1d16aa53f283d574f4ca5/docs/checks.md#sast"}}]},"last_synced_at":"2026-01-21T02:26:27.009Z","repository_id":43002355,"created_at":"2026-01-21T02:26:27.009Z","updated_at":"2026-01-21T02:26:27.009Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34043828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphicsmagick","node-pdf","node-pdf-to-image","node-pdf2img","pdf","pdf-to-image"],"created_at":"2025-05-14T23:12:28.728Z","updated_at":"2026-06-08T01:07:29.981Z","avatar_url":"https://github.com/yakovmeister.png","language":"TypeScript","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=938FMCPPQG4DQ\u0026currency_code=USD\u0026source=url","https://www.paypal.com/paypalme/yakovmeister"],"categories":["📦 Modules/Packages","TypeScript"],"sub_categories":[":curly_loop: Typography"],"readme":"# pdf2pic\n\n[![Donate][paypal-image]](https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=938FMCPPQG4DQ\u0026currency_code=USD\u0026source=url)\n![Build Status][github-actions-url]\n[![CodeFactor](https://www.codefactor.io/repository/github/yakovmeister/pdf2image/badge)](https://www.codefactor.io/repository/github/yakovmeister/pdf2image)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6d7bfbae9057998bda99/maintainability)](https://codeclimate.com/github/yakovmeister/pdf2image/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/6d7bfbae9057998bda99/test_coverage)](https://codeclimate.com/github/yakovmeister/pdf2image/test_coverage)\n[![install size](https://packagephobia.com/badge?p=pdf2pic)](https://packagephobia.com/result?p=pdf2pic)\n[![NPM Version][npm-image]][npm-url]\n[![License](https://img.shields.io/npm/l/pdf2pic?color=blue)][npm-url]\n[![Known Vulnerabilities](https://snyk.io/test/npm/pdf2pic/badge.svg)](https://snyk.io/test/npm/pdf2pic)\n[![Downloads Stats][npm-downloads]][npm-url]\n\nA utility for converting pdf to image, base64 or buffer format.\n\n\u003e IMPORTANT NOTE: Please support this library by donating via [PayPal](https://www.paypal.com/paypalme/yakovmeister), your help is much appreciated. Contributors are also welcome!\n\n## Prerequisites\n\n* node \u003e= 14.x \n* graphicsmagick\n* ghostscript\n\n### Don't have graphicsmagick and ghostscript yet?\n\nFollow [this](docs/gm-installation.md) guide to install the required dependencies.\n\n## Installation\n\n```\nnpm install --save pdf2pic\n```\n\n## Usage\n\n### Converting specific page of PDF from path, then saving as image file\n\n```javascript\nimport { fromPath } from \"pdf2pic\";\n\nconst options = {\n  density: 100,\n  saveFilename: \"untitled\",\n  savePath: \"./images\",\n  format: \"png\",\n  width: 600,\n  height: 600\n};\nconst convert = fromPath(\"/path/to/pdf/sample.pdf\", options);\nconst pageToConvertAsImage = 1;\n\nconvert(pageToConvertAsImage, { responseType: \"image\" })\n  .then((resolve) =\u003e {\n    console.log(\"Page 1 is now converted as image\");\n\n    return resolve;\n  });\n```\n\n### Nuff talk, show me how:\nMore usage example can be found [here](https://github.com/yakovmeister/pdf2pic-examples).\n\n## pdf2pic API\n\n- [fromPath(filePath, options)](#frompathfilepath-options)\n- [fromBuffer(buffer, options)](#frombufferbuffer-options)\n- [fromBase64(b64string, options)](#frombase64b64string-options)\n\n### fromPath(filePath, options)\n\nInitialize PDF to image conversion by supplying a file path\n\n#### Functions\n\nConvert a specific page of the PDF to Image/Base64/Buffer by supplying a file path\n\n```javascript\nfromPath(filePath, options)(page, convertOptions)\n```\n* filePath - pdf file's path\n* options - see [options](#options).\n* page - page number to convert to an image\n* convertOptions - see [convertOptions](#convertoptions).\n\n---\n\nConverts PDF to Image/Base64/Buffer by supplying a file path\n```javascript\nfromPath(filePath, options).bulk(pages, convertOptions)\n```\n* filePath - pdf file's path\n* options - see [options](#options).\n* pages - page numbers to convert to image\n  * set `pages` to `-1` to convert all pages\n  * `pages` also accepts an array indicating the page number e.g. `[1,2,3]`\n  * also accepts number e.g. `1`\n* convertOptions - see [convertOptions](#convertoptions)\n\n---\n\nSet GraphicsMagick's subclass or path\n```javascript\nfromPath(filePath, options).setGMClass(subClass)\n```\nNOTE: should be called before calling `convert()` or `bulk()`.\n* filePath - pdf file's path\n* options - see [options](#options).\n* subClass - path to gm binary or set to true to use imagemagick\n  * set `subClass` to true to use imagemagick\n  * supply a valid path as `subClass` to locate gm path specified\n\n---\n\n### fromBuffer(buffer, options)\n \nInitialize PDF to image conversion by supplying a PDF buffer\n\n#### Functions\n\nConvert a specific page of the PDF to Image/Base64/Buffer by supplying a buffer\n```javascript\nfromBuffer(buffer, options)(page, convertOptions)\n```\n\nFunctions same as `fromPath(filePath, options)(page, convertOptions)` only input is changed\n\n---\nConverts PDF to Image/Base64/Buffer by supplying a buffer:\n\n```javascript\nfromBuffer(buffer, options).bulk(pages, convertOptions)\n```\n\nFunctions same as `fromPath(filePath, options).bulk(pages, convertOptions)` only input is changed\n\n---\nSet GraphicsMagick's subclass or path:\n```javascript\nfromBuffer(buffer, options).setGMClass(subClass)\n```\n\nFunctions same as `fromPath(filePath, options).setGMClass(subClass)` only input is changed\n\n---\n\n### fromBase64(b64string, options)\nInitialize PDF to image conversion by supplying a PDF base64 string.\n\n#### Functions\nConvert a specific page of the PDF to Image/Base64/Buffer by supplying a base64 string:\n```javascript\nfromBase64(b64string, options)(page, convertOptions)\n```\n\nFunctions same as `fromPath(filePath, options)(page, convertOptions)` only input is changed.\n\n---\nConverts PDF to Image/Base64/Buffer by supplying a base64 string:\n\n```javascript\nfromBase64(b64string, options).bulk(pages, convertOptions)\n```\n\nFunctions same as `fromPath(filePath, options).bulk(pages, convertOptions)` only input is changed.\n\n---\nSet GraphicsMagick's subclass or path:\n```javascript\nfromBase64(b64string, options).setGMClass(subClass)\n```\n\nFunctions same as `fromPath(filePath, options).setGMClass(subClass)` only input is changed.\n---\n### options\nFollowing are the options that can be passed on the pdf2pic api:\n\n| option              | default value | description                                                                                                                                                                                                                                                                   |\n|---------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| quality             | `0`           | Image compression level. Value depends on `format`, usually from `0` to `100` ([more info](http://www.graphicsmagick.org/GraphicsMagick.html#details-quality))                                                                                                                |\n| format              | `'png'`       | Formatted image characteristics / image format ([image characteristics](http://www.graphicsmagick.org/GraphicsMagick.html#details-format), [image format](http://www.graphicsmagick.org/formats.html))                                                                        |\n| width               | `768`         | Output width                                                                                                                                                                                                                                                                  |\n| height              | `512`         | Output height                                                                                                                                                                                                                                                                 |\n| preserveAspectRatio | `false`       | Maintains the aspect ratio of the image. When set to `true` and both `width` and `height` are specified, they are interpreted as the minimum width and minimum height, respectively. If set to `true` with only the `width` specified, the `height` will be automatically determined while preserving the aspect ratio, and vice versa. |\n| density             | `72`          | Output DPI (dots per inch) ([more info](http://www.graphicsmagick.org/GraphicsMagick.html#details-density))                                                                                                                                                                   |\n| savePath            | `'./'`        | Path where to save the output                                                                                                                                                                                                                                                 |\n| saveFilename        | `'untitled'`  | Output filename                                                                                                                                                                                                                                                               |\n| compression         | `'jpeg'`      | Compression method ([more info](http://www.graphicsmagick.org/GraphicsMagick.html#details-compress))                                                                                                                                                                          |\n\n### convertOptions\n\n| option       | default value | description |\n|--------------|---------------|-------------|\n| responseType | `image`       | Response type of the output. Accepts: `image`, `base64` or `buffer` |\n\nThe parameter can also be a boolean, if `true` then the response type will be `base64` and if `false` then the response type will be `image`. \nThis is deprecated and will be removed in the next major version.\n\n## Contributing\n* Fork it (https://github.com/yakovmeister/pdf2image/fork)\n* Create your feature branch (git checkout -b feature/make-maintainer-cry)\n* Commit your changes (git commit -am 'feature: make maintainer cry by running git rm -rf')\n* Push to the branch (git push origin feature/make-maintainer-cry)\n* Create a new PR\n\n## License\npdf2pic is [MIT licensed](LICENSE).\n\n\u003c!-- Markdown link \u0026 img dfn's --\u003e\n[npm-image]: https://img.shields.io/npm/v/pdf2pic.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/pdf2pic\n[npm-downloads]: https://img.shields.io/npm/dm/pdf2pic.svg?style=flat-square\n[github-actions-url]: https://github.com/yakovmeister/pdf2image/actions/workflows/test.yml/badge.svg?branch=master\n[paypal-image]: https://img.shields.io/badge/Donate-PayPal-green.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakovmeister%2Fpdf2image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyakovmeister%2Fpdf2image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakovmeister%2Fpdf2image/lists"}