{"_id":"@bluemarket/puppedf","_rev":"1-c7d5b062b63fdef8ce049318cce3009f","name":"@bluemarket/puppedf","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@bluemarket/puppedf","repository":{"type":"git","url":"git+https://github.com/bluemarket-blue/puppedf.git"},"version":"1.0.0","description":"library that easily converts an html template into a pdf with data","main":"dist/app.js","types":"dist/app.d.js","scripts":{"start":"node dist/app.js","watch-ts":"tsc -w","build":"tsc"},"author":{"name":"Tyren & Lisandro"},"license":"MIT","bugs":{"url":"https://github.com/bluemarket-blue/puppedf/issues"},"homepage":"https://github.com/bluemarket-blue/puppedf#readme","dependencies":{"puppeteer":"^20.9.0","typescript":"^5.1.6"},"gitHead":"748e8826d0ea34a2e6c6e54eaf8293067ad68f24","_id":"@bluemarket/puppedf@1.0.0","_nodeVersion":"18.14.1","_npmVersion":"9.3.1","dist":{"integrity":"sha512-LT+My6k9st0IkID6IBYi/tXGy2FSf35C4XbPD1/E7nzwP6gyDIP9N6cesHJ4ZNjxOXV2ma3nC2Cl41avjtz9pA==","shasum":"861d3a44072db88b8534911e4116248b177b6231","tarball":"https://registry.npmjs.org/@bluemarket/puppedf/-/puppedf-1.0.0.tgz","fileCount":19,"unpackedSize":22537,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6+fXodWZTmazO8m9cLp2nSUKJrdObe2o1HlpB/MvGgwIhAPDKe/Zt1z0MxWhDzUXtnjW3+oVbyhUNTe1ScxFE11mT"}]},"_npmUser":{"name":"bluemarket","email":"guillaume.vailland@bluemarket.blue"},"directories":{},"maintainers":[{"name":"bluemarket","email":"guillaume.vailland@bluemarket.blue"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppedf_1.0.0_1690986036609_0.6989938554132122"},"_hasShrinkwrap":false},"1.1.1":{"name":"@bluemarket/puppedf","repository":{"type":"git","url":"git+https://github.com/bluemarket-blue/puppedf.git"},"version":"1.1.1","description":"library that easily converts an html template into a pdf with data","main":"dist/app.js","types":"dist/app.d.js","scripts":{"start":"node dist/app.js","watch-ts":"tsc -w","build":"tsc"},"author":{"name":"Tyren & Lisandro"},"license":"MIT","bugs":{"url":"https://github.com/bluemarket-blue/puppedf/issues"},"homepage":"https://github.com/bluemarket-blue/puppedf#readme","dependencies":{"puppeteer":"^20.9.0","typescript":"^5.1.6"},"gitHead":"f3313759cb009b9ed7bb8ff06c27ad5f41f7bf8e","_id":"@bluemarket/puppedf@1.1.1","_nodeVersion":"18.14.1","_npmVersion":"9.3.1","dist":{"integrity":"sha512-JYe/t1LZGuXrSHb9M/6C0TlZJtnkaDSAynKFisHjbeLQnE1tb3kXH65ZMBCLy60b416ajjE6knADBn/wz15SUg==","shasum":"5e0a3d968dfd0b304c04cbc35bddbb1c181d8e98","tarball":"https://registry.npmjs.org/@bluemarket/puppedf/-/puppedf-1.1.1.tgz","fileCount":19,"unpackedSize":24115,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGjGrVyYZevInyRYc85Dw52Lh9YqokJ3Z+MnX3ZEZttZAiAu5iPaorQeFqMCdzqPJeaGwzR8c+epYvHyqlFozHnKkw=="}]},"_npmUser":{"name":"bluemarket","email":"guillaume.vailland@bluemarket.blue"},"directories":{},"maintainers":[{"name":"bluemarket","email":"guillaume.vailland@bluemarket.blue"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/puppedf_1.1.1_1691418063849_0.7468210702192506"},"_hasShrinkwrap":false}},"time":{"created":"2023-08-02T14:20:36.520Z","1.0.0":"2023-08-02T14:20:36.808Z","modified":"2023-08-07T14:21:04.095Z","1.1.1":"2023-08-07T14:21:03.996Z"},"maintainers":[{"name":"bluemarket","email":"guillaume.vailland@bluemarket.blue"}],"description":"library that easily converts an html template into a pdf with data","homepage":"https://github.com/bluemarket-blue/puppedf#readme","repository":{"type":"git","url":"git+https://github.com/bluemarket-blue/puppedf.git"},"author":{"name":"Tyren & Lisandro"},"bugs":{"url":"https://github.com/bluemarket-blue/puppedf/issues"},"license":"MIT","readme":"<div align=\"center\">\r\n        <img src=\"/docs/images/logo.png\" alt=\"Puppedf logo\" align=\"center\" />\r\n</div>\r\n\r\n<h1 align=\"center\">Puppedf - Easiest way to generate pdf from html </h1>\r\n<h3 align=\"center\">Use your Template and feed with data</h3>\r\n<div align=\"center\">\r\n\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n\r\n\r\n\r\n</div>\r\n\r\n<div align=\"center\"><b>Links:<br> <a href=\"https://bluemarket.blue\">Website</a> • <a href=\"https://https://pptr.dev\">Puppeteer</a></div>\r\n<br>\r\n\r\n\r\n## About\r\n\r\nPuppedf is an npm library that lets you easily convert HTML templates into PDF files using Puppeteer. You can also replace keys in the HTML template with specified values to customize the content of the generated PDF.\r\n\r\n## Why puppedf\r\n\r\nWe needed to generate legal documents for the operation of our platform, such as invoices, contracts and so on. We needed a tool that would enable us to always follow the same template, but also allow us to automate the modification of fields. That's why we created this npm package\r\n\r\n## Features\r\n\r\nPuppedf provides the following features:\r\n\r\n- **PDF generation from HTML templates**\r\n- **Customize PDF content by replacing keys in the template**\r\n- **Support for PDF generation options to adjust format, headers, footers, etc**\r\n- **will give you a ReadbleStream or a pdf file**\r\n\r\n\r\n## Installation\r\n\r\nInstall via NPM:\r\n\r\n```bash\r\nnpm install @bluemarket/puppedf\r\n```\r\n\r\nInstalling via npm is currently the default.\r\n\r\n## Getting started\r\n\r\nTo start using Puppedf, import the function `generatePDFstream`. :\r\n\r\n```javascript\r\nimport { generatePDFstream } from '@bluemarket-blue/puppedf';\r\n```\r\n\r\nThen call the function to generate a PDF :\r\n\r\n```javascript\r\nconst html = '\r\n                <!DOCTYPE html>\r\n                <html lang=\"fr\">\r\n                        <head>\r\n                            <meta charset=\"UTF-8\">\r\n                            <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n                            <title>Ma page HTML5</title>\r\n                        </head>\r\n                        <body>\r\n                            <h1>Hello, Puppedf!</h1>\r\n                        </body>\r\n                </html>';\r\n\r\nconst pdfStream = await generatePDFstream(html);\r\n\r\n// You can then save the PDF as a file\r\nawait savePDFToFile(pdfStream, './output.pdf');\r\n```\r\n\r\nYou can also replace keys in the HTML template using a key-value array :\r\n\r\n```javascript\r\n\r\nconst htmlTemplate = '\r\n                <!DOCTYPE html>\r\n                <html lang=\"fr\">\r\n                        <head>\r\n                            <meta charset=\"UTF-8\">\r\n                            <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n                            <title>Ma page HTML5</title>\r\n                                <style>\r\n                                        body {\r\n                                                background-color: #00FF00;\r\n                                                }\r\n                                </style>\r\n                        </head>\r\n                        <body>\r\n                            <h1>Hello, {{name}}!</h1>\r\n                        </body>\r\n                </html>';\r\n\r\nconst data = [{ key: 'name', value: 'John Doe' }];\r\n\r\nconst pdfStream = await generatePDFstream(htmlTemplate, data);\r\n\r\n\r\n```\r\n\r\n\r\nAnd you can always use puppeteer's full range of options to style your pdf. :\r\n\r\n```javascript\r\n\r\nconst htmlTemplate = '\r\n                <!DOCTYPE html>\r\n                <html lang=\"fr\">\r\n                        <head>\r\n                            <meta charset=\"UTF-8\">\r\n                            <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\r\n                            <title>Ma page HTML5</title>\r\n                                <style>\r\n                                        body {\r\n                                                background-color: #00FF00;\r\n                                                }\r\n                                </style>\r\n                        </head>\r\n                        <body>\r\n                            <h1>Hello, {{name}}!</h1>\r\n                        </bod\r\n\r\n\r\nconst data = [{ key: 'name', value: 'John Doe' }];\r\n\r\nconst options = {\r\n  printBackground: true,\r\n  landscape: true\r\n}\r\nconst data = [{ key: 'name', value: 'John Doe' }];\r\n\r\nconst pdfStream = await generatePDFstream(htmlTemplate, data, options);\r\n\r\n```\r\n## PDF generation options\r\n\r\nYou can customize PDF generation using the following options:\r\n\r\n- `displayHeaderFooter`: Display header and footer (Boolean)\r\n- `headerTemplate`: Header template\r\n- `footerTemplate`: Footer template\r\n- `format`: Paper format (e.g. 'A4', 'Letter', 'Legal', etc.)\r\n- `height`: Paper height in inches or millimeters.\r\n- `landscape`: Display in landscape mode (Boolean)\r\n- `margin`: Paper margins\r\n- `omitBackground`: Omit background when generating (Boolean)\r\n- `pageRanges`: Page ranges to be included in the PDF (e.g. '1-5', '2', '7-10')\r\n- `path`: PDF save path\r\n- `preferCSSPageSize`: Use CSS size rather than paper size (Boolean)\r\n- `printBackground`: Print page backgrounds (Boolean)\r\n- `scale`: Page scale (float)\r\n- `timeout`: Timeout for PDF generation (in milliseconds)\r\n- `width`: Paper width in inches or millimeters\r\n\r\nMore detail here https://pptr.dev/api/puppeteer.pdfoptions\r\n\r\n## Examples\r\n\r\nYou can find usage examples in the `examples` folder of the GitHub repository.\r\n\r\n## Contribution\r\n\r\nContributions are welcome! If you find a bug or want to add a new feature, don't hesitate to open an issue or propose a pull request.\r\n\r\n## License\r\n\r\nPuppedf is distributed under the MIT license. See the `LICENSE` file for more information.\r\n\r\n---\r\n\r\nFeel free to adjust the content to suit your needs and add screenshots or other relevant information. This should provide a solid basis for your README to inform users of your npm package and facilitate their use. Good luck with your project!\r\n\r\n## Repository\r\n\r\n[Repository](https://github.com/bluemarket-blue/puppedf)\r\n\r\n## Changelog\r\n\r\n[Changelog](https://github.com/bluemarket-blue/puppedf/releases)\r\n\r\n## Inspiration\r\n\r\nIf you like the framework, it will be very cool if you rate the repository with a star ★\r\n\r\n\r\n\r\n","readmeFilename":"README.md"}