{"_id":"@akash3080/html-to-pdf-node","_rev":"3-7add714bff203856705e28755895cfc7","name":"@akash3080/html-to-pdf-node","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@akash3080/html-to-pdf-node","version":"1.0.0","description":"A opensource package for node to convert html to pdf ","main":"index.js","scripts":{"test":"mocha tests/*.js -R spec --ui bdd --timeout 10000"},"author":{"name":"CoderDotJs"},"license":"ISC","dependencies":{"bluebird":"^3.7.2","handlebars":"^4.7.7","inline-css":"^4.0.2","puppeteer":"^19.8.5"},"devDependencies":{"chai":"^4.3.7","mocha":"^10.2.0"},"keywords":["html","pdf","nodejs","puppeteer","handlebars","ejs","express js","react"],"repository":{"type":"git","url":"git+https://github.com/CoderDotJs/html-to-pdf-node.git"},"bugs":{"url":"https://github.com/CoderDotJs/html-to-pdf-node/issues"},"homepage":"https://github.com/CoderDotJs/html-to-pdf-node#readme","gitHead":"6aa045b188b8328caabd1e29bed4e0c36573417b","_id":"@akash3080/html-to-pdf-node@1.0.0","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-y48Cu71/qLUfJUduUPZD4uVad/DLIUDmjZEKMeJapWW0elj3kQrj03yxh32TucWqAR58rGWkjiVny3vntJWW7Q==","shasum":"0ee8a06f41863dad9268ef0791d0c61840772ebe","tarball":"https://registry.npmjs.org/@akash3080/html-to-pdf-node/-/html-to-pdf-node-1.0.0.tgz","fileCount":5,"unpackedSize":8994,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+FfcbMq2f4O1XmqtqfuydLSfOsQssQjD6a/PBvqhbBgIhAJ+Gcw6+YiVj7Aqe2odMZjhaU8iqIWW7EWLckwqpbJsd"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkMSHyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoDzA//c+MIcw1sKkfx9FGOkuO6c3OtNQo9AskAmDfc62NpKh59D23W\r\nbtWIWSf5ki8UKO2NC1BP9fx1fKwlBzJf4eQ9TY9NX4kUP2CxZghN8/FFw1Y/\r\n4RqaGLZQeKNfdPQ8ftDVERzaxg0Sdh8aDJZiPPsUK3qDqoOh97R5hfSCpbUD\r\n9ScRvNA9L0Xx8UsVsjT+2CXc4W7shln7n07RguaEVMdn94rDxtTfp44Aqxy9\r\n8RKb0c2HdkwRhbaj1sWOE0wXdc7/jwlZJMIyVHhDotWfp40y3nOpabDUVaIE\r\n8ZO4SAaIhS2ts2/KfWmh7JpxMaK9d7LaeY7oU4PXZdytaHI0RMTSMoWolbBW\r\ntGqpPPLxcz44XWfif+EfHWkLAEkwmPVkQK8owJFFrIThYIQg7JElXvwtsAt0\r\ngsC+UshrVHMHjXpMOgBG+ZJ4fFrPBWwHEaFbL7aCPnN6RLlXxqShSpUcFQw6\r\nQzyp8fJnIEcYRmS29G8wTldXhoiUS83//qysDtWXpH31nfOtrQizaSkxyNcK\r\nTp9+UyA4HTp9lMjAGO+ecuPGutsdZo0LmWKO9D1X08+1sZdvpmklhBmFqYZx\r\nlAY0n/4WScx7H0XtclABYnQgyzExgp2uC1R8N2AhVa2CK12bK0vyx+e9mkvS\r\nOn+8LoLxmDc6FJVogh8TBTPENiV37vzfh3Q=\r\n=s3Mt\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"akash3080","email":"md.akash6724@gmail.com"},"directories":{},"maintainers":[{"name":"akash3080","email":"md.akash6724@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-to-pdf-node_1.0.0_1680941554254_0.5471170550197444"},"_hasShrinkwrap":false},"1.0.1":{"name":"@akash3080/html-to-pdf-node","version":"1.0.1","description":"A opensource package for node to convert html to pdf ","main":"index.js","scripts":{"test":"mocha tests/*.js -R spec --ui bdd --timeout 10000"},"author":{"name":"CoderDotJs"},"license":"ISC","dependencies":{"bluebird":"^3.7.2","handlebars":"^4.7.7","inline-css":"^4.0.2","puppeteer":"^19.8.5"},"devDependencies":{"chai":"^4.3.7","mocha":"^10.2.0"},"keywords":["html","pdf","nodejs","puppeteer","handlebars","ejs","express js","react"],"repository":{"type":"git","url":"git+https://github.com/CoderDotJs/html-to-pdf-node.git"},"bugs":{"url":"https://github.com/CoderDotJs/html-to-pdf-node/issues"},"homepage":"https://github.com/CoderDotJs/html-to-pdf-node#readme","gitHead":"aa15b23e0bc84d9fb872f90626d1a1b853156247","_id":"@akash3080/html-to-pdf-node@1.0.1","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-B+wwi6EUd72+88LuG26R1/BQK6OltoDXmPABpj7pd9VCpoBYrLoRMYr6GoOlVBiMqRQTBkb5I8IerbYcGdWV1w==","shasum":"9f5fb5fa73483f104c61a5216449010e5f20ac49","tarball":"https://registry.npmjs.org/@akash3080/html-to-pdf-node/-/html-to-pdf-node-1.0.1.tgz","fileCount":5,"unpackedSize":21307,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID6bJxxz8p4of7FnwYBZiGIn3AUFuYdBfYE1EZm0f6TBAiEA0/CXEqjTcmdUlV9Fi6aZaTkQq7YN8R8E3x5jP16TkeM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkMSOkACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmpr3A//eeIQB1dbBYHxlmjgOSY/4c65vdQGXY3FdcTeu57YvHcju/oV\r\nOKZk7QarfEvZj3TMZn9wV21XPR5NxNf/XahwgqL1sVBCKtiUgYNvAbHwYAtr\r\nBntC0t9+J19CD/Tp1M0YrkzqmhfaHPRG22IBPYOB8oqyZFB+8Es+ZGfcIUB8\r\n+GZzcuizbLvY/83+nfafOw3h4SraR0z9bdu9FsMNA61RhcAnkL8XtzCUifjo\r\nyZ9+AuNHVhlExwsFsIO6h8cY+xrnRWqenk/VrksT2sPbb7iCCLVHKoWYLkD9\r\ncMBhOUYHxA1fTCQZu+4jRUzsdmsgsK0lZ8ZU6MhfExNK7LZQiQUnWJHspyDp\r\nX7asMLO4YFsf47/TZOOE2WLlE+0XyxZ1jWPIjjMBct6IqdaSCDToteEorrR9\r\noDFoy9982J9a40zNVFgKZyz3BqHxVGVWfCU7E0sqNvdD+5hv7Y5GMSnfGUSd\r\nRqhBL1ndD8/Ko+5TbCBOe37IuAe5HyC1nqMagpUXkZrqjVsYBn8h2R/KFFMx\r\n3S8SC4ubJ7vmNP1mMwmPFcKEeoUZV7eLL+R0NdMtnDnpL83TRCEEd2rEKsPi\r\nu/io41yyPBoYrcKWCqklpFooRQm5V+OkdHlkIFvPjfZZEdZZqR3blQjcHxgf\r\nKIAbI6uIu34tE0WWbt1zO9XvgT3rwboInjE=\r\n=aJxv\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"akash3080","email":"md.akash6724@gmail.com"},"directories":{},"maintainers":[{"name":"akash3080","email":"md.akash6724@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-to-pdf-node_1.0.1_1680941988192_0.6737372246624531"},"_hasShrinkwrap":false},"1.0.2":{"name":"@akash3080/html-to-pdf-node","version":"1.0.2","description":"A opensource package for node to convert html to pdf ","main":"index.js","scripts":{"test":"mocha tests/*.js -R spec --ui bdd --timeout 10000"},"author":{"name":"CoderDotJs"},"license":"ISC","dependencies":{"bluebird":"^3.7.2","handlebars":"^4.7.7","inline-css":"^4.0.2","puppeteer":"^19.8.5"},"devDependencies":{"chai":"^4.3.7","mocha":"^10.2.0"},"keywords":["html","pdf","nodejs","puppeteer","handlebars","ejs","express js","react"],"repository":{"type":"git","url":"git+https://github.com/CoderDotJs/html-to-pdf-node.git"},"bugs":{"url":"https://github.com/CoderDotJs/html-to-pdf-node/issues"},"homepage":"https://github.com/CoderDotJs/html-to-pdf-node#readme","gitHead":"4a0289e3a02e6afa4439b291bb5e6a4536b0bc98","_id":"@akash3080/html-to-pdf-node@1.0.2","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-9/AqofxqPNzHb6I5LasDwFopWemMF23GJ6Lq2331tgOilDXZ5aU7YTxCa+LLWzH7wKMBVmoXKfEiSl3aVc7hyg==","shasum":"b791dc63cd98309168cb3e7f7a81c1fe9e8df269","tarball":"https://registry.npmjs.org/@akash3080/html-to-pdf-node/-/html-to-pdf-node-1.0.2.tgz","fileCount":5,"unpackedSize":21329,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCphhFTfTAFBWs9oL5gAx+2ym9AlrbBCeH8YQ3nRl57IgIgdgwVL89vh8ZXCk7uEnh7X7/lAk9LFK4UVpVPEG8lz9o="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkMSSdACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmorvQ/+NQikW/re8vTF0EwaFzeGIsC+30iIVXiSYaxbGIO4uV9bxXxQ\r\n9pRYe0d9aifvCTl1oC7qn2ZVfQpQ/KvngPUy0JEf0yd2ks3lnZmhSTrTypdF\r\nU69/NObbt/qUtyNBAqo3rsNjMXCy7lN6/4XxSFDR+PZf7m/C3xKfGULd57pn\r\nN5OP7psOjcWMCKJZQl8a0nwho8P5kqPnQNZQovgreqZVmDsVuXW1dHjtH4nG\r\nas3URsLv6j1PimbW9p3vrOf+FoaBc80r8D7aGehXehIcqzEdAyUz5aT9XZVV\r\n3O2FBqeVAnPURX4kA7y9th6HCNOAZIkhT7GlP4c0H88PRFJgWUlOGbA5Eefg\r\nQHqEWg6/VLFYbnA1CEG66ugQnu+kCFmFVh9KXLV4XHhqLJLncy7bqfcbaYlX\r\nD2lhQvCQkRG1K4tvLjDsekW5RAcZRvnCrEol7PWNX6O7zFkvIMhyEMcNUBHD\r\nQowii+xNB75O4O043dnITMauAyJEGtvN7OBmTLoX8/59Iow99r+7uR9QuBp8\r\n0phw2CWmGRhSRtJwbP/vYqa8//NZiL1uKoVDS9RU+paASrpV6JeOsHQdqwr/\r\nld3DdNNYv1+E4e7IvO9YgBL2ZSWhbvQH5wtl1DamBz2FUQ6VWO5tGOMN1mCG\r\nBwhgvkP+pZXUJ1jSJT388qTOc0FFxST9rQ0=\r\n=WEUT\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"akash3080","email":"md.akash6724@gmail.com"},"directories":{},"maintainers":[{"name":"akash3080","email":"md.akash6724@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-to-pdf-node_1.0.2_1680942237292_0.17946923888497368"},"_hasShrinkwrap":false},"1.0.3":{"name":"@akash3080/html-to-pdf-node","version":"1.0.3","description":"A opensource package for node to convert html to pdf ","main":"index.js","scripts":{"test":"mocha tests/*.js -R spec --ui bdd --timeout 10000"},"author":{"name":"CoderDotJs"},"license":"ISC","dependencies":{"bluebird":"^3.7.2","handlebars":"^4.7.7","inline-css":"^4.0.2","puppeteer":"^19.8.5"},"devDependencies":{"chai":"^4.3.7","mocha":"^10.2.0"},"keywords":["html","pdf","nodejs","puppeteer","handlebars","ejs","express js","react"],"repository":{"type":"git","url":"git+https://github.com/CoderDotJs/html-to-pdf-node.git"},"bugs":{"url":"https://github.com/CoderDotJs/html-to-pdf-node/issues"},"homepage":"https://github.com/CoderDotJs/html-to-pdf-node#readme","gitHead":"45f5ea45f3a450c5371712fabd5b7cbbe8272641","_id":"@akash3080/html-to-pdf-node@1.0.3","_nodeVersion":"18.15.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-KPvUPirv1kNtWf+6LKGqsuHHmpxgSBPQ6lw7Yf77k8G4wwpRk+PPQ8QoXzyzwVHhIAiZeb2nW+e9YQCkg0KFKA==","shasum":"abf19d21830649d6323e01ab6f301c1773638acd","tarball":"https://registry.npmjs.org/@akash3080/html-to-pdf-node/-/html-to-pdf-node-1.0.3.tgz","fileCount":5,"unpackedSize":21350,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDMweCu0gn2/jJrK0B5/qJasJk1vaNOfbSCFd6cIhDgngIhAJyzr0g1u6Ul7k8qXRcYGTt9sUVUBMihleieEkKvVvkx"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkUhWbACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoFahAAifOrDaPzoDWFf41AJDToDNALByLOcsfwwzIae37JYJFrXK9Q\r\n0r/ci95l5CsFiguMD2ZA85r3U+eJ+OLYohrBqXSA0DBRZHm4S7v5pkO4dFSj\r\nyzruLGoSsYDUiPY66PvGI+olgIQZ5pEfw11V6s7e+qB+i4mgHwHdFoHqTEir\r\nxl6du1/NxwCMghOjIxDBKVn1+a0uyoKWHfYiRHuzN1E1hd54kIk3X92PiVoG\r\ngEq1OmI1ozndUpoeIlGCblTozxMLkJIhYeEIm4Dlp+zZ4rH+IeuBjGbrG8Mv\r\nCDj5HR6xMi+jeoP7/e0FMPyaEyAWPpqIAgsIlT0EVRXi+YFeEm9wFheFH+Ue\r\nNwe29HrDA5ZODmz5Oo08pMZC8qrFaBQDfCZ3DybGBSkpw7lDzV/JQS5J8Mn2\r\nXhxjEtFwcw3GcEDvXf7gd2D+TVAqRi/uuxzobZfqOyM4SeerYMHKSi79I612\r\nXNeJnvkYuQR4g68HMI4hKLsF2kB88mulhbTE+WL6JZZ0yYIuSEN1gft1n8nh\r\njzVKNTBUD+J01jUk5ImC5macIEpWPR92VAZKaj+TEobgxqYTVzdU9JfFfbx/\r\n6UeHGyA+r5ErUEpHw+v/fbve9aKQbYkZKD7a27qJLA1NPdwTkeoxYJgdSejs\r\ntRxCMYyR08VbXqcn1/z7vnMc89BOZniR3y4=\r\n=xb56\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"akash3080","email":"md.akash6724@gmail.com"},"directories":{},"maintainers":[{"name":"akash3080","email":"md.akash6724@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/html-to-pdf-node_1.0.3_1683101083676_0.2968988037745126"},"_hasShrinkwrap":false}},"time":{"created":"2023-04-08T08:12:34.199Z","1.0.0":"2023-04-08T08:12:34.449Z","modified":"2023-05-03T08:04:43.947Z","1.0.1":"2023-04-08T08:19:48.358Z","1.0.2":"2023-04-08T08:23:57.446Z","1.0.3":"2023-05-03T08:04:43.821Z"},"maintainers":[{"name":"akash3080","email":"md.akash6724@gmail.com"}],"description":"A opensource package for node to convert html to pdf ","homepage":"https://github.com/CoderDotJs/html-to-pdf-node#readme","keywords":["html","pdf","nodejs","puppeteer","handlebars","ejs","express js","react"],"repository":{"type":"git","url":"git+https://github.com/CoderDotJs/html-to-pdf-node.git"},"author":{"name":"CoderDotJs"},"bugs":{"url":"https://github.com/CoderDotJs/html-to-pdf-node/issues"},"license":"ISC","readme":"# html-to-pdf-node\r\n\r\n> Pagination plugin for converts html or url to pdf\r\n\r\n# **Note:** This plugin will convert html page or public URL into PDF. This will work with Node.js\r\n\r\n## Installation\r\n\r\n```sh\r\nnpm install @akash3080/html-to-pdf-node\r\n```\r\n\r\n## Usage\r\n\r\nTo convert `HTML` page to `PDF` using `generatePdf` method:\r\n\r\n```js\r\nvar html_to_pdf = require(\"@akash3080/html-to-pdf-node\");\r\n\r\nlet options = { format: \"A4\" };\r\n// Example of options with args //\r\n// let options = { format: 'A4', args: ['--no-sandbox', '--disable-setuid-sandbox'] };\r\n\r\nlet file = { content: \"<h1>Welcome to html-to-pdf-node</h1>\" };\r\n// or //\r\nlet file = { url: \"https://example.com\" };\r\nhtml_to_pdf.generatePdf(file, options).then((pdfBuffer) => {\r\n  console.log(\"PDF Buffer:-\", pdfBuffer);\r\n});\r\n```\r\n\r\n### html_to_pdf.generatePdf ( [file], [options], [callback] )\r\n\r\n**Parameters**\r\n\r\n`file` <[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object \"Object\")> File object should have one of the following properties:\r\n\r\n- `url` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> Any public url of the PDF.\r\n- `content`<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> HTML file content of the PDF.\r\n\r\n`options` <[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object \"Object\")> Options object should have the following properties:\r\n\r\n- `args` <[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array \"Array\")<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")>> Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/). This options will overwrite the default arguments. The default arguments are `['--no-sandbox', '--disable-setuid-sandbox']`.\r\n- `path` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> The file path to save the PDF to. If `path` is a relative path, then it is resolved to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, the PDF won't be saved anywhere.\r\n- `scale` <[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2.\r\n- `displayHeaderFooter` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\")> Display header and footer. Defaults to `false`.\r\n- `headerTemplate` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> HTML template to print the header. Should be valid HTML markup with following classes used to inject printing values into them:\r\n  - `date` formatted date\r\n  - `title` document title\r\n  - `url` document location\r\n  - `pageNumber` current page number\r\n  - `totalPages` total pages in the document\r\n- `footerTemplate` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> HTML template to print the footer. Should use the same format as the `headerTemplate`.\r\n- `printBackground` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\")> Print background graphics. Defaults to `false`.\r\n- `landscape` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\")> Paper orientation. Defaults to `false`.\r\n- `pageRanges` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.\r\n- `format` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> Paper format. If set, takes priority over `width` or `height` options. Defaults to 'Letter'.\r\n- `width` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Paper width, accepts values labeled with units.\r\n- `height` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Paper height, accepts values labeled with units.\r\n- `margin` <[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object \"Object\")> Paper margins, defaults to none.\r\n  - `top` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Top margin, accepts values labeled with units.\r\n  - `right` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Right margin, accepts values labeled with units.\r\n  - `bottom` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Bottom margin, accepts values labeled with units.\r\n  - `left` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Left margin, accepts values labeled with units.\r\n- `preferCSSPageSize` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\")> Give any CSS `@page` size declared in the page priority over what is declared in `width` and `height` or `format` options. Defaults to `false`, which will scale the content to fit the paper size.\r\n\r\n**Return value**\r\n\r\nPromise which resolves with PDF buffer.\r\n\r\n### html_to_pdf.generatePdfs ( [files], [options], [callback] )\r\n\r\n**Parameters**\r\n\r\n`files` <[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array \"Array\")<[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object \"Object\")>> File object should have one of the follwing properties:\r\n\r\n- `url` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> Any public url of the PDF.\r\n- `content`<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> HTML file content of the PDF.\r\n\r\n`options` <[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object \"Object\")> Options object should have the following properties:\r\n\r\n- `args` <[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array \"Array\")<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")>> Additional arguments to pass to the browser instance. The list of Chromium flags can be found [here](http://peter.sh/experiments/chromium-command-line-switches/). This options will overwrite the default arguments. The default arguments are `['--no-sandbox', '--disable-setuid-sandbox']`.\r\n- `path` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> The file path to save the PDF to. If `path` is a relative path, then it is resolved to [current working directory](https://nodejs.org/api/process.html#process_process_cwd). If no path is provided, the PDF won't be saved anywhere.\r\n- `scale` <[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Scale of the webpage rendering. Defaults to `1`. Scale amount must be between 0.1 and 2.\r\n- `displayHeaderFooter` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\")> Display header and footer. Defaults to `false`.\r\n- `headerTemplate` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> HTML template to print the header. Should be valid HTML markup with following classes used to inject printing values into them:\r\n  - `date` formatted date\r\n  - `title` document title\r\n  - `url` document location\r\n  - `pageNumber` current page number\r\n  - `totalPages` total pages in the document\r\n- `footerTemplate` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> HTML template to print the footer. Should use the same format as the `headerTemplate`.\r\n- `printBackground` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\")> Print background graphics. Defaults to `false`.\r\n- `landscape` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\")> Paper orientation. Defaults to `false`.\r\n- `pageRanges` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> Paper ranges to print, e.g., '1-5, 8, 11-13'. Defaults to the empty string, which means print all pages.\r\n- `format` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")> Paper format. If set, takes priority over `width` or `height` options. Defaults to 'Letter'.\r\n- `width` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Paper width, accepts values labeled with units.\r\n- `height` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Paper height, accepts values labeled with units.\r\n- `margin` <[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object \"Object\")> Paper margins, defaults to none.\r\n  - `top` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Top margin, accepts values labeled with units.\r\n  - `right` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Right margin, accepts values labeled with units.\r\n  - `bottom` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Bottom margin, accepts values labeled with units.\r\n  - `left` <[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type \"String\")|[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type \"Number\")> Left margin, accepts values labeled with units.\r\n- `preferCSSPageSize` <[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type \"Boolean\")> Give any CSS `@page` size declared in the page priority over what is declared in `width` and `height` or `format` options. Defaults to `false`, which will scale the content to fit the paper size.\r\n\r\n**Return value**\r\n\r\nPromise which resolves with array of object which contains file objects with PDF buffers.\r\n\r\n**_Example:_**\r\n\r\n```js\r\nlet options = { format: \"A4\" };\r\nlet file = [{ url: \"https://example.com\", name: \"example.pdf\" }];\r\n\r\nhtml_to_pdf.generatePdfs(file, options).then((output) => {\r\n  console.log(\"PDF Buffer:-\", output); // PDF Buffer:- [{url: \"https://example.com\", name: \"example.pdf\", buffer: <PDF buffer>}]\r\n});\r\n```\r\n","readmeFilename":"readme.md"}