{"_id":"@accountable/html-pdf","_rev":"4-6ca92d8c77adcc1c0d0050ca72a5f656","name":"@accountable/html-pdf","dist-tags":{"latest":"3.0.4"},"versions":{"3.0.2":{"name":"@accountable/html-pdf","version":"3.0.2","keywords":["html","pdf","phantom","phantomjs","nodejs"],"author":{"name":"Marc Bachmann"},"license":"MIT","_id":"@accountable/html-pdf@3.0.2","maintainers":[{"name":"jzone1994","email":"juan@accountable.eu"},{"name":"blu.accountable","email":"mokhtar@accountable.eu"},{"name":"aless.accountable","email":"alessandro@accountable.eu"}],"homepage":"https://github.com/Accountable-SA/accountable-node-html-pdf","bugs":{"url":"https://github.com/Accountable-SA/accountable-node-html-pdf/issues"},"bin":{"html-pdf":"bin/index.js"},"dist":{"shasum":"387ba7a53010d917653b06d8e5920f24205dc4be","tarball":"https://registry.npmjs.org/@accountable/html-pdf/-/html-pdf-3.0.2.tgz","fileCount":13,"integrity":"sha512-mhauDHpA0Uq/rrKkrvIKqQSNIQFPNbHdfzre8r6ULgMivsVCLS26iRMu1VY+P0O84dDQZfXaIFFcels0BpKo4A==","signatures":[{"sig":"MEUCICfa613zXqBA6Vl0o0KDDKpebYZFMR9ZEJLXEa7zzVFIAiEAuXCm6vE2xcXcAuArVnG9JwdGEk+wiqzbTfn3ZtW+OIg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":118190},"main":"lib/index.js","engines":{"node":">=4.0.0"},"gitHead":"fc1acab57d2c7bfe08a267816ba6d0aa83b2d923","scripts":{"test":"standard && tape test/index.js examples/*/test.js"},"_npmUser":{"name":"aless.accountable","email":"alessandro@accountable.eu"},"repository":{"url":"git://github.com/Accountable-SA/accountable-node-html-pdf.git","type":"git"},"_npmVersion":"10.9.2","description":"HTML to PDF converter that uses phantomjs","directories":{"test":"test"},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"tape":"^5.2.2","standard":"^5.1.1","tap-spec":"^5.0.0","phantomjs-prebuilt":"^2.1.16"},"optionalDependencies":{"phantomjs-prebuilt":"^2.1.16"},"_npmOperationalInternal":{"tmp":"tmp/html-pdf_3.0.2_1759305585705_0.07775411494660478","host":"s3://npm-registry-packages-npm-production"}},"3.0.3":{"name":"@accountable/html-pdf","version":"3.0.3","keywords":["html","pdf","phantom","phantomjs","nodejs"],"author":{"name":"Marc Bachmann"},"license":"MIT","_id":"@accountable/html-pdf@3.0.3","maintainers":[{"name":"jzone1994","email":"juan@accountable.eu"},{"name":"blu.accountable","email":"mokhtar@accountable.eu"},{"name":"aless.accountable","email":"alessandro@accountable.eu"},{"name":"julesalbert","email":"jules@accountable.eu"}],"homepage":"https://github.com/Accountable-SA/accountable-node-html-pdf","bugs":{"url":"https://github.com/Accountable-SA/accountable-node-html-pdf/issues"},"bin":{"html-pdf":"bin/index.js"},"dist":{"shasum":"27680cff127602abad9d9c86d05df0bfee493119","tarball":"https://registry.npmjs.org/@accountable/html-pdf/-/html-pdf-3.0.3.tgz","fileCount":13,"integrity":"sha512-yzH35mhx5D4zszvToQfeopGvlYZfehVpagCio72zccmF57kC0FB/xy46A4z21IC4d2mREMvuJDa5egyHxrQY3Q==","signatures":[{"sig":"MEUCIQCklWVEWYq87V1iUvYNJ7+0YwUDQ6CzvA30lZxGCfcE3wIgKjRMF7IMXy0AORoQgPClUEV6xtJXZ54Lwv2bFrfxp6o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":118337},"main":"lib/index.js","engines":{"node":">=4.0.0"},"gitHead":"b4683c60992f4f76c1d56ac87f30271dc85b44ef","scripts":{"test":"standard && tape test/index.js examples/*/test.js"},"_npmUser":{"name":"aless.accountable","email":"alessandro@accountable.eu"},"repository":{"url":"git://github.com/Accountable-SA/accountable-node-html-pdf.git","type":"git"},"_npmVersion":"10.9.2","description":"HTML to PDF converter that uses phantomjs","directories":{"test":"test"},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"tape":"^5.2.2","standard":"^5.1.1","tap-spec":"^5.0.0","phantomjs-prebuilt":"^2.1.16"},"optionalDependencies":{"phantomjs-prebuilt":"^2.1.16"},"_npmOperationalInternal":{"tmp":"tmp/html-pdf_3.0.3_1759408291936_0.8192220279176385","host":"s3://npm-registry-packages-npm-production"}},"3.0.4":{"name":"@accountable/html-pdf","version":"3.0.4","description":"HTML to PDF converter that uses phantomjs","engines":{"node":">=4.0.0"},"main":"lib/index.js","directories":{"test":"test"},"bin":{"html-pdf":"bin/index.js"},"scripts":{"test":"standard && tape test/index.js examples/*/test.js"},"author":{"name":"Marc Bachmann"},"license":"MIT","devDependencies":{"phantomjs-prebuilt":"^2.1.16","standard":"^5.1.1","tap-spec":"^5.0.0","tape":"^5.2.2"},"optionalDependencies":{"phantomjs-prebuilt":"^2.1.16"},"repository":{"type":"git","url":"git://github.com/Accountable-SA/accountable-node-html-pdf.git"},"keywords":["html","pdf","phantom","phantomjs","nodejs"],"bugs":{"url":"https://github.com/Accountable-SA/accountable-node-html-pdf/issues"},"homepage":"https://github.com/Accountable-SA/accountable-node-html-pdf","_id":"@accountable/html-pdf@3.0.4","gitHead":"9c777ada2d3b2dd439778f1de311e1bd317809e5","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-hVcJyDU83aunzX/GBhbXaOQP72WYFh3SCwSIu8hMc8loNerQ+FxZ49liJVN/Nz3eaTWqkbDeks2BVoA7acmu8w==","shasum":"871db92c9726059d4a0603d90c5509f941eabcb2","tarball":"https://registry.npmjs.org/@accountable/html-pdf/-/html-pdf-3.0.4.tgz","fileCount":13,"unpackedSize":118539,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDSJl7JYVx7/KIDe8MdsVVYerKYeBfd/DAJvnmvjqlG3wIgXC0hg2m6gwh9iSVQwhhSs0861bxL2Q93OY8lxxofpcs="}]},"_npmUser":{"name":"aless.accountable","email":"alessandro@accountable.eu"},"maintainers":[{"name":"jzone1994","email":"juan@accountable.eu"},{"name":"blu.accountable","email":"mokhtar@accountable.eu"},{"name":"aless.accountable","email":"alessandro@accountable.eu"},{"name":"julesalbert","email":"jules@accountable.eu"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/html-pdf_3.0.4_1759408829880_0.5085717646178409"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-01T07:59:45.606Z","modified":"2025-10-02T12:40:30.371Z","3.0.2":"2025-10-01T07:59:45.920Z","3.0.3":"2025-10-02T12:31:32.103Z","3.0.4":"2025-10-02T12:40:30.106Z"},"bugs":{"url":"https://github.com/Accountable-SA/accountable-node-html-pdf/issues"},"author":{"name":"Marc Bachmann"},"license":"MIT","homepage":"https://github.com/Accountable-SA/accountable-node-html-pdf","keywords":["html","pdf","phantom","phantomjs","nodejs"],"repository":{"type":"git","url":"git://github.com/Accountable-SA/accountable-node-html-pdf.git"},"description":"HTML to PDF converter that uses phantomjs","maintainers":[{"name":"jzone1994","email":"juan@accountable.eu"},{"name":"blu.accountable","email":"mokhtar@accountable.eu"},{"name":"aless.accountable","email":"alessandro@accountable.eu"},{"name":"julesalbert","email":"jules@accountable.eu"}],"readme":"# @accountable/html-pdf\n\n[![npm version](https://img.shields.io/npm/v/@accountable/html-pdf.svg)](https://www.npmjs.com/package/@accountable/html-pdf)\n\nThis is a fork of the original project [marcbachmann/node-html-pdf](https://github.com/marcbachmann/node-html-pdf)\n\nThe original project is now unmaintained. 3.0.1 is the last version published by Marc Bachmann. Any version before that can be found on the releases page of the original repository.\n\nChanges made in this fork:\n\n- Fix edge case where PhantomJS exits with code 0 but no data is received, generating a \"Cannot read property 'filename' of undefined\" error.\n\n## Changelog\n\nHave a look at the releases page for versions prior to 3.0.2: https://github.com/marcbachmann/node-html-pdf/releases\n\nFor the changelog of this fork see: https://github.com/Accountable-SA/accountable-node-html-pdf/releases\n\n## HTML to PDF converter that uses phantomjs\n\n![image](examples/businesscard/businesscard.png)  \n[Example Business Card](examples/businesscard/businesscard.pdf)  \n -> [and its Source file](examples/businesscard/businesscard.html)\n\n[Example Receipt](http://imgr-static.s3-eu-west-1.amazonaws.com/order.pdf)\n\n## Installation\n\nInstall the @accountable/html-pdf utility via [npm](http://npmjs.org/):\n\n```\n$ npm install -g @accountable/html-pdf\n```\n\n## Command-line example\n\n```\n$ @accountable/html-pdf test/businesscard.html businesscard.pdf\n```\n\n## Code example\n\n```javascript\nvar fs = require(\"fs\");\nvar pdf = require(\"html-pdf\");\nvar html = fs.readFileSync(\"./test/businesscard.html\", \"utf8\");\nvar options = { format: \"Letter\" };\n\npdf.create(html, options).toFile(\"./businesscard.pdf\", function (err, res) {\n  if (err) return console.log(err);\n  console.log(res); // { filename: '/app/businesscard.pdf' }\n});\n```\n\n## API\n\n```js\nvar pdf = require('html-pdf');\npdf.create(html).toFile([filepath, ]function(err, res){\n  console.log(res.filename);\n});\n\npdf.create(html).toStream(function(err, stream){\n  stream.pipe(fs.createWriteStream('./foo.pdf'));\n});\n\npdf.create(html).toBuffer(function(err, buffer){\n  console.log('This is a buffer:', Buffer.isBuffer(buffer));\n});\n\n\n// for backwards compatibility\n// alias to pdf.create(html[, options]).toBuffer(callback)\npdf.create(html [, options], function(err, buffer){});\n```\n\n### Footers and Headers\n\n`html-pdf` can read the header or footer either out of the `footer` and `header` config object or out of the html source. You can either set a default header & footer or overwrite that by appending a page number (1 based index) to the `id=\"pageHeader\"` attribute of a html tag.\n\nYou can use any combination of those tags. The library tries to find any element, that contains the `pageHeader` or `pageFooter` id prefix.\n\n```html\n<div id=\"pageHeader\">Default header</div>\n<div id=\"pageHeader-first\">Header on first page</div>\n<div id=\"pageHeader-2\">Header on second page</div>\n<div id=\"pageHeader-3\">Header on third page</div>\n<div id=\"pageHeader-last\">Header on last page</div>\n...\n<div id=\"pageFooter\">Default footer</div>\n<div id=\"pageFooter-first\">Footer on first page</div>\n<div id=\"pageFooter-2\">Footer on second page</div>\n<div id=\"pageFooter-last\">Footer on last page</div>\n```\n\n## Options\n\n```javascript\nconfig = {\n\n  // Export options\n  \"directory\": \"/tmp\",       // The directory the file gets written into if not using .toFile(filename, callback). default: '/tmp'\n\n  // Papersize Options: http://phantomjs.org/api/webpage/property/paper-size.html\n  \"height\": \"10.5in\",        // allowed units: mm, cm, in, px\n  \"width\": \"8in\",            // allowed units: mm, cm, in, px\n  - or -\n  \"format\": \"Letter\",        // allowed units: A3, A4, A5, Legal, Letter, Tabloid\n  \"orientation\": \"portrait\", // portrait or landscape\n\n  // Page options\n  \"border\": \"0\",             // default is 0, units: mm, cm, in, px\n  - or -\n  \"border\": {\n    \"top\": \"2in\",            // default is 0, units: mm, cm, in, px\n    \"right\": \"1in\",\n    \"bottom\": \"2in\",\n    \"left\": \"1.5in\"\n  },\n\n  paginationOffset: 1,       // Override the initial pagination number\n  \"header\": {\n    \"height\": \"45mm\",\n    \"contents\": '<div style=\"text-align: center;\">Author: Marc Bachmann</div>'\n  },\n  \"footer\": {\n    \"height\": \"28mm\",\n    \"contents\": {\n      first: 'Cover page',\n      2: 'Second page', // Any page number is working. 1-based index\n      default: '<span style=\"color: #444;\">{{page}}</span>/<span>{{pages}}</span>', // fallback value\n      last: 'Last Page'\n    }\n  },\n\n\n  // Rendering options\n  \"base\": \"file:///home/www/your-asset-path/\", // Base path that's used to load files (images, css, js) when they aren't referenced using a host\n\n  // Zooming option, can be used to scale images if `options.type` is not pdf\n  \"zoomFactor\": \"1\", // default is 1\n\n  // File options\n  \"type\": \"pdf\",           // allowed file types: png, jpeg, pdf\n  \"quality\": \"75\",         // only used for types png & jpeg\n\n  // Script options\n  \"phantomPath\": \"./node_modules/phantomjs/bin/phantomjs\", // PhantomJS binary which should get downloaded automatically\n  \"phantomArgs\": [], // array of strings used as phantomjs args e.g. [\"--ignore-ssl-errors=yes\"]\n  \"localUrlAccess\": false, // Prevent local file:// access by passing '--local-url-access=false' to phantomjs\n                           // For security reasons you should keep the default value if you render arbritary html/js.\n  \"script\": '/url',        // Absolute path to a custom phantomjs script, use the file in lib/scripts as example\n  \"timeout\": 30000,        // Timeout that will cancel phantomjs, in milliseconds\n\n  // Time we should wait after window load\n  // accepted values are 'manual', some delay in milliseconds or undefined to wait for a render event\n  \"renderDelay\": 1000,\n\n  // HTTP Headers that are used for requests\n  \"httpHeaders\": {\n    // e.g.\n    \"Authorization\": \"Bearer ACEFAD8C-4B4D-4042-AB30-6C735F5BAC8B\"\n  },\n\n  // To run Node application as Windows service\n  \"childProcessOptions\": {\n    \"detached\": true\n  }\n\n  // HTTP Cookies that are used for requests\n  \"httpCookies\": [\n    // e.g.\n    {\n      \"name\": \"Valid-Cookie-Name\", // required\n      \"value\": \"Valid-Cookie-Value\", // required\n      \"domain\": \"localhost\",\n      \"path\": \"/foo\", // required\n      \"httponly\": true,\n      \"secure\": false,\n      \"expires\": (new Date()).getTime() + (1000 * 60 * 60) // e.g. expires in 1 hour\n    }\n  ]\n\n}\n```\n\nThe full options object gets converted to JSON and will get passed to the phantomjs script as third argument.  \nThere are more options concerning the paperSize, header & footer options inside the phantomjs script.\n","readmeFilename":"README.md"}