{"_rev":"3-bd5127aee2e829b03a52d1014c73435d","time":{"created":"2024-12-08T15:11:08.293Z","modified":"2024-12-08T15:11:08.909Z","3.6.0":"2024-12-08T15:05:03.202Z","3.6.1":"2024-12-08T15:11:08.575Z"},"_id":"@bloodgang/pdf-to-png-converter","name":"@bloodgang/pdf-to-png-converter","dist-tags":{"latest":"3.6.1"},"versions":{"3.6.1":{"name":"@bloodgang/pdf-to-png-converter","version":"3.6.1","description":"Node.js utility to convert PDF file/buffer pages to PNG files/buffers with no native dependencies.","keywords":["pdf","pdf to png","pdf to image","pdf file to image","pdf buffer to image"],"homepage":"https://github.com/dichovsky/pdf-to-png-converter#readme","bugs":{"url":"https://github.com/dichovsky/pdf-to-png-converter/issues"},"repository":{"type":"git","url":"git+https://github.com/dichovsky/pdf-to-png-converter.git"},"license":"MIT","author":{"name":"Igor Magdich","email":"magdich.igor@gmail.com"},"main":"out/index.js","types":"out/index.d.ts","scripts":{"prebuild":"npm run clean","build":"tsc --pretty --project tsconfig.prod.json","build:test":"tsc --pretty --noEmit --project tsconfig.json","clean":"rimraf ./out ./coverage ./test-results","docker:build":"docker build --compress -t test-pdf-to-png-converter .","predocker:run":"npm run clean","docker:run":"docker run --rm -it -v $PWD/test-results:/usr/pkg/test-results test-pdf-to-png-converter","docker:test":"vitest run","license-checker":"npx license-checker --production --onlyAllow 'MIT; MIT OR X11; BSD; ISC; Apache-2.0; Unlicense'","lint":"eslint .","lint:fix":"npm run lint -- --fix","pretest":"npm run clean","test":"vitest run --coverage","test:docker":"npm run docker:build && npm run docker:run"},"dependencies":{"pdfjs-dist":"^4.9.155"},"devDependencies":{"@types/node":"^22.7.8","@typescript-eslint/eslint-plugin":"^8.11.0","@typescript-eslint/parser":"^8.11.0","@vitest/coverage-v8":"^2.1.3","eslint":"^9.13.0","png-visual-compare":"^2.1.0","rimraf":"^6.0.1","typescript":"^5.6.3","vitest":"^2.1.3"},"engines":{"node":">=18.0.0"},"_id":"@bloodgang/pdf-to-png-converter@3.6.1","gitHead":"1ce81458a828411794e7e332b958bed6083b8f4c","_nodeVersion":"22.12.0","_npmVersion":"10.9.1","dist":{"integrity":"sha512-ypqpc5437pAVnFkKw5ibeeXdDMjxnYmbGfwGey4QB4se2TfajexUIUVRJK1tkSQnBf5XP8223dYLYAOp93+SAQ==","shasum":"91890f80552f7ebf0abca3a8a7e4a2b538f26a5e","tarball":"https://registry.npmjs.org/@bloodgang/pdf-to-png-converter/-/pdf-to-png-converter-3.6.1.tgz","fileCount":23,"unpackedSize":21905,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDwQVqfUNPc/Onl23W66BjvZQVDsE4S9g9i21nt4uTDQAiAqZ0RL5NR1VK1bUVegibtD0/eibKtA0k1w/HbXY62O3Q=="}]},"_npmUser":{"name":"bloodgang94","email":"alexso94@yandex.ru"},"directories":{},"maintainers":[{"name":"bloodgang94","email":"alexso94@yandex.ru"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pdf-to-png-converter_3.6.1_1733670668396_0.8049606560098388"},"_hasShrinkwrap":false}},"maintainers":[{"name":"bloodgang94","email":"alexso94@yandex.ru"}],"description":"Node.js utility to convert PDF file/buffer pages to PNG files/buffers with no native dependencies.","homepage":"https://github.com/dichovsky/pdf-to-png-converter#readme","keywords":["pdf","pdf to png","pdf to image","pdf file to image","pdf buffer to image"],"repository":{"type":"git","url":"git+https://github.com/dichovsky/pdf-to-png-converter.git"},"author":{"name":"Igor Magdich","email":"magdich.igor@gmail.com"},"bugs":{"url":"https://github.com/dichovsky/pdf-to-png-converter/issues"},"license":"MIT","readme":"# pdf-to-png-converter\r\n\r\nNode.js utility to convert PDF file/buffer pages to PNG files/buffers without binary and OS dependencies (except macOS on arm64).\r\n\r\n[![Tests on push](https://github.com/dichovsky/pdf-to-png-converter/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/dichovsky/pdf-to-png-converter/actions/workflows/test.yml)\r\n\r\n## Getting Started\r\n\r\n### macOS M1 Prerequisites\r\n\r\nmacOS M1 dependencies prerequisites installation:\r\n\r\n```bash\r\narch -arm64 brew install pkg-config cairo pango libpng librsvg\r\n```\r\n\r\n### Package Installation\r\n\r\nInstallation:\r\n\r\n```sh\r\nnpm install -D pdf-to-png-converter\r\n```\r\n\r\n## Example\r\n\r\n```javascript\r\nconst { pdfToPng } = require('pdf-to-png-converter');\r\n\r\ntest(`Convert PDF To PNG`, async () => {\r\n    const pngPages = await pdfToPng(pdfFilePath, { // The function accepts PDF file path or a Buffer\r\n        disableFontFace: false, // When `false`, fonts will be rendered using a built-in font renderer that constructs the glyphs with primitive path commands. Default value is true.\r\n        useSystemFonts: false, // When `true`, fonts that aren't embedded in the PDF document will fallback to a system font. Default value is false.\r\n        enableXfa: false, // Render Xfa forms if any. Default value is false.\r\n        viewportScale: 2.0, // The desired scale of PNG viewport. Default value is 1.0.\r\n        outputFolder: 'output/folder', // Folder to write output PNG files. If not specified, PNG output will be available only as a Buffer content, without saving to a file.\r\n        outputFileMaskFunc, // Output filename mask function.\r\n        pdfFilePassword: 'pa$$word', // Password for encrypted PDF.\r\n        pagesToProcess: [1, 3, 11], // Subset of pages to convert (first page = 1), other pages will be skipped if specified.\r\n        strictPagesToProcess: false, // When `true`, will throw an error if specified page number in pagesToProcess is invalid, otherwise will skip invalid page. Default value is false.\r\n        verbosityLevel: 0 // Verbosity level. ERRORS: 0, WARNINGS: 1, INFOS: 5. Default value is 0.\r\n    });\r\n    // Further processing of pngPages\r\n});\r\n```\r\n\r\n## Output\r\n\r\nThe output of the `pdfToPng` function is an array of objects with the following structure:\r\n\r\n```javascript\r\n{\r\n    pageNumber: number; // Page number in PDF file\r\n    name: string; // PNG page name (use outputFileMaskFunc to change it)\r\n    content: Buffer; // PNG page Buffer content\r\n    path: string; // Path to the rendered PNG page file (empty string if outputFilesFolder is not provided)\r\n    width: number; // PNG page width\r\n    height: number; // PNG page height\r\n}\r\n```\r\n\r\n## Buy Me A Coffee\r\n\r\nIn case you want to support my work:\r\n\r\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://buymeacoffee.com/dichovsky)\r\n\r\n","readmeFilename":"README.md"}