{"id":17306638,"url":"https://github.com/tcort/wkhtmltox","last_synced_at":"2025-08-21T02:31:42.191Z","repository":{"id":17429663,"uuid":"20202911","full_name":"tcort/wkhtmltox","owner":"tcort","description":"high performance access to `wkhtmltopdf` and `wkhtmltoimage` from node.js.","archived":false,"fork":false,"pushed_at":"2023-04-27T12:49:38.000Z","size":141,"stargazers_count":61,"open_issues_count":8,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-12-15T11:35:20.977Z","etag":null,"topics":["jpg","nodejs","pdf","png","wkhtmltopdf"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tcort.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-05-27T01:13:28.000Z","updated_at":"2024-10-08T01:32:46.000Z","dependencies_parsed_at":"2024-06-18T20:11:05.136Z","dependency_job_id":null,"html_url":"https://github.com/tcort/wkhtmltox","commit_stats":{"total_commits":113,"total_committers":7,"mean_commits":"16.142857142857142","dds":"0.20353982300884954","last_synced_commit":"9223e48d2cf4dc036ba299c9832751b67a36ce12"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fwkhtmltox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fwkhtmltox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fwkhtmltox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcort%2Fwkhtmltox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tcort","download_url":"https://codeload.github.com/tcort/wkhtmltox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230479865,"owners_count":18232630,"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":["jpg","nodejs","pdf","png","wkhtmltopdf"],"created_at":"2024-10-15T11:58:57.857Z","updated_at":"2024-12-19T18:17:04.668Z","avatar_url":"https://github.com/tcort.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"wkhtmltox\n=========\n\nThe goal of this module is to provide high performance access to `wkhtmltopdf` and `wkhtmltoimage` from node.js.\nThose two tools are from [wkhtmltopdf](http://wkhtmltopdf.org/), a software package that\nprovides utilities for rendering HTML into various formats using the QT Webkit rendering engine.\n\nThis module is based on an [MIT](http://opensource.org/licenses/MIT) licensed module named [node-wkhtmltopdf](https://github.com/devongovett/node-wkhtmltopdf).\n\nRequirements\n------------\n\n* [nodejs](http://nodejs.org/) v4 or later.\n* [wkhtmltopdf/wkhtmltoimage](http://wkhtmltopdf.org/) v0.12 (with patched qt) or later.\n\nInstall\n-------\n\nThe latest and greatest version of this software is available through [npm](http://npmjs.org/).\n\n    npm install wkhtmltox\n\nExamples\n--------\n\n**HTML to PDF, JPG, PNG with custom path**\n\n```js\n// include the node module\nvar wkhtmltox = require(\"wkhtmltox\");\n\n// instantiate a new converter.\nvar converter = new wkhtmltox();\n\n// Locations of the binaries can be specified, but this is\n// only needed if the programs are located outside your PATH\nconverter.wkhtmltopdf   = '/opt/local/bin/wkhtmltopdf';\nconverter.wkhtmltoimage = '/opt/local/bin/wkhtmltoimage';\n\n// Convert to pdf.\n// Function takes (inputStream, optionsObject), returns outputStream.\nconverter.pdf(fs.createReadStream('foo.html'), { pageSize: \"letter\" })\n    .pipe(fs.createWriteStream(\"foo.pdf\"))\n    .on(\"finish\", done);\n\n// Convert to image.\n// Function takes (inputStream, optionsObject), returns outputStream.\nconverter.image(fs.createReadStream('foo.html'), { format: \"jpg\" })\n    .pipe(fs.createWriteStream(\"foo.jpg\"))\n    .on(\"finish\", done);\n\nconverter.image(fs.createReadStream('foo.html'), { format: \"png\" })\n    .pipe(fs.createWriteStream(\"foo.png\"))\n    .on(\"finish\", done);\n```\n**Simple HTML to PDF web service**\n\nHere's a simple web server that converts HTML to PDF. Options can be supplied as query parameters:\n```js\nvar url = require('url');\nvar http = require('http');\nvar wkhtmltox = require('wkhtmltox');\nvar converter = new wkhtmltox();\n\nhttp.createServer(function (req, res) {\n    res.writeHead(200, {'Content-Type': 'application/pdf'});\n    converter.pdf(req, url.parse(req.url, true).query).pipe(res);\n}).listen(1337, '127.0.0.1');\n\nconsole.log('Server running at http://127.0.0.1:1337/');\n```\nAccess it with [curl](http://curl.haxx.se/)\n\n    curl -d @test.html -s \"http://localhost:1337/?copies=2\" -o test.pdf\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcort%2Fwkhtmltox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftcort%2Fwkhtmltox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcort%2Fwkhtmltox/lists"}