{"id":13808281,"url":"https://github.com/devongovett/node-wkhtmltopdf","last_synced_at":"2025-05-15T09:03:53.021Z","repository":{"id":8505063,"uuid":"10115183","full_name":"devongovett/node-wkhtmltopdf","owner":"devongovett","description":"A wrapper for the wkhtmltopdf HTML to PDF converter using WebKit","archived":false,"fork":false,"pushed_at":"2023-03-09T09:29:31.000Z","size":60,"stargazers_count":611,"open_issues_count":43,"forks_count":147,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-05-15T09:03:09.746Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"twbs/bootstrap","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devongovett.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2013-05-17T03:13:46.000Z","updated_at":"2025-05-12T07:21:38.000Z","dependencies_parsed_at":"2024-01-08T08:05:31.084Z","dependency_job_id":null,"html_url":"https://github.com/devongovett/node-wkhtmltopdf","commit_stats":{"total_commits":72,"total_committers":19,"mean_commits":3.789473684210526,"dds":0.6527777777777778,"last_synced_commit":"51745d803a65134dd87c30fd3276ca48630e467d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fnode-wkhtmltopdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fnode-wkhtmltopdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fnode-wkhtmltopdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devongovett%2Fnode-wkhtmltopdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devongovett","download_url":"https://codeload.github.com/devongovett/node-wkhtmltopdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310513,"owners_count":22049468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-04T01:01:38.914Z","updated_at":"2025-05-15T09:03:52.974Z","avatar_url":"https://github.com/devongovett.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"node-wkhtmltopdf [![Build Status](https://travis-ci.org/devongovett/node-wkhtmltopdf.svg)](https://travis-ci.org/devongovett/node-wkhtmltopdf)\n================\n\nA Node.js wrapper for the [wkhtmltopdf](http://wkhtmltopdf.org/) command line tool.  As the name implies, \nit converts HTML documents to PDFs using WebKit.\n\n## Installation\n\nFirst, you need to install the `wkhtmltopdf` command line tool on your system.\n\nThe **easiest way** to do this is to\n[download](http://wkhtmltopdf.org/downloads.html#stable) a prebuilt version for your system.  **DO NOT** try to use\nthe packages provided by your distribution as they may not be using a patched Qt and have missing features.\n\nFinally, to install the node module, use `npm`:\n\n    npm install wkhtmltopdf\n    \nBe sure the `wkhtmltopdf` command line tool is in your PATH when you're done installing.  If you don't want to do this for some reason, you can change\nthe `require('wkhtmltopdf').command` property to the path to the `wkhtmltopdf` command line tool.\n\n## Usage\n\n### wkhtmltopdf(source, [options], [callback]);\n\n```javascript\nvar wkhtmltopdf = require('wkhtmltopdf');\n\n// URL\nwkhtmltopdf('http://google.com/', { pageSize: 'letter' })\n  .pipe(fs.createWriteStream('out.pdf'));\n  \n// HTML\nwkhtmltopdf('\u003ch1\u003eTest\u003c/h1\u003e\u003cp\u003eHello world\u003c/p\u003e')\n  .pipe(res);\n\n// Stream input and output\nvar stream = wkhtmltopdf(fs.createReadStream('file.html'));\n\n// output to a file directly\nwkhtmltopdf('http://apple.com/', { output: 'out.pdf' });\n\n// Optional callback\nwkhtmltopdf('http://google.com/', { pageSize: 'letter' }, function (err, stream) {\n  // do whatever with the stream\n});\n\n// Repeatable options\nwkhtmltopdf('http://google.com/', {\n  allow : ['path1', 'path2'],\n  customHeader : [\n    ['name1', 'value1'],\n    ['name2', 'value2']\n  ]\n});\n\n// Ignore warning strings\nwkhtmltopdf('http://apple.com/', { \n  output: 'out.pdf',\n  ignore: ['QFont::setPixelSize: Pixel size \u003c= 0 (0)']\n});\n// RegExp also acceptable\nwkhtmltopdf('http://apple.com/', { \n  output: 'out.pdf',\n  ignore: [/QFont::setPixelSize/]\n});\n```\n\n`wkhtmltopdf` is just a function, which you call with either a URL or an inline HTML string, and it returns\na stream that you can read from or pipe to wherever you like (e.g. a file, or an HTTP response).\n\n## Options\n\nThere are [many options](http://wkhtmltopdf.org/docs.html) available to\nwkhtmltopdf.  All of the command line options are supported as documented on the page linked to above.  The\noptions are camelCased instead-of-dashed as in the command line tool. Note that options that do not have values, must be specified as a boolean, e.g. **debugJavascript: true**\n\nThere is also an `output` option that can be used to write the output directly to a filename, instead of returning\na stream.\n\n### Debug Options\n\nApart from the **debugJavascript** option from wkhtmltopdf, there is an additional options **debug** and **debugStdOut** which will help you debug rendering issues, by outputting data to the console. **debug** prints and **stderr** messages while **debugStdOut** prints any **stdout** warning messages.\n\n## Tests\n\nRun `npm test` and manually check that generated files are like the expected files. The test suit prints the paths of the files that needs to be compared.\n\n**TODO** - Find a way to automatically compare the PDF files.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fnode-wkhtmltopdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevongovett%2Fnode-wkhtmltopdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevongovett%2Fnode-wkhtmltopdf/lists"}