{"id":22509169,"url":"https://github.com/adrg/go-wkhtmltopdf","last_synced_at":"2025-05-16T13:07:51.243Z","repository":{"id":10101174,"uuid":"64483558","full_name":"adrg/go-wkhtmltopdf","owner":"adrg","description":"Handcrafted Go bindings for wkhtmltopdf and high-level HTML to PDF conversion interface","archived":false,"fork":false,"pushed_at":"2025-03-25T13:39:22.000Z","size":135,"stargazers_count":265,"open_issues_count":3,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-03T10:11:13.115Z","etag":null,"topics":["bindings","converter","go","golang","golang-library","golang-package","html","html-to-pdf","library","native","pdf","pdf-conversion","pdf-converter","wkhtmltopdf","wkhtmltox"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/adrg/go-wkhtmltopdf","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adrg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"ko_fi":"adrg"}},"created_at":"2016-07-29T13:43:46.000Z","updated_at":"2025-04-01T03:57:58.000Z","dependencies_parsed_at":"2024-06-05T14:32:26.523Z","dependency_job_id":"0de03fb1-f032-4b33-aeb9-b1b66e4eadee","html_url":"https://github.com/adrg/go-wkhtmltopdf","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Fgo-wkhtmltopdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Fgo-wkhtmltopdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Fgo-wkhtmltopdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adrg%2Fgo-wkhtmltopdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adrg","download_url":"https://codeload.github.com/adrg/go-wkhtmltopdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248545686,"owners_count":21122195,"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":["bindings","converter","go","golang","golang-library","golang-package","html","html-to-pdf","library","native","pdf","pdf-conversion","pdf-converter","wkhtmltopdf","wkhtmltox"],"created_at":"2024-12-07T01:27:54.059Z","updated_at":"2025-04-12T09:28:48.295Z","avatar_url":"https://github.com/adrg.png","language":"Go","funding_links":["https://ko-fi.com/adrg","https://ko-fi.com/T6T72WATK"],"categories":["Go"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cdiv\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/adrg/adrg.github.io/master/assets/projects/go-wkhtmltopdf/logo.svg\" alt=\"go-wkhtmltopdf logo\"/\u003e\n  \u003c/div\u003e\n\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eGo bindings and high-level HTML to PDF conversion interface.\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/adrg/go-wkhtmltopdf/actions/workflows/tests.yml\"\u003e\n        \u003cimg alt=\"Tests status\" src=\"https://github.com/adrg/go-wkhtmltopdf/actions/workflows/tests.yml/badge.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pkg.go.dev/github.com/adrg/go-wkhtmltopdf\"\u003e\n        \u003cimg alt=\"pkg.go.dev documentation\" src=\"https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\" rel=\"nofollow\"\u003e\n        \u003cimg alt=\"MIT license\" src=\"https://img.shields.io/github/license/adrg/go-wkhtmltopdf\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://goreportcard.com/report/github.com/adrg/go-wkhtmltopdf\"\u003e\n        \u003cimg alt=\"Go report card\" src=\"https://goreportcard.com/badge/github.com/adrg/go-wkhtmltopdf\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://discord.gg/Jd63kBf\"\u003e\n        \u003cimg alt=\"Discord channel\" src=\"https://img.shields.io/discord/767381740427542588?label=discord\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/adrg/go-wkhtmltopdf/issues\"\u003e\n        \u003cimg alt=\"GitHub issues\" src=\"https://img.shields.io/github/issues/adrg/go-wkhtmltopdf\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://ko-fi.com/T6T72WATK\"\u003e\n        \u003cimg alt=\"Buy me a coffee\" src=\"https://img.shields.io/static/v1.svg?label=%20\u0026message=Buy%20me%20a%20coffee\u0026color=579fbf\u0026logo=buy%20me%20a%20coffee\u0026logoColor=white\"/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\nImplements [wkhtmltopdf](https://wkhtmltopdf.org) Go bindings. It can be used to convert HTML documents to PDF files.\nThe package does not use the `wkhtmltopdf` binary. Instead, it uses the `wkhtmltox` library directly.\n\nFull documentation can be found at https://pkg.go.dev/github.com/adrg/go-wkhtmltopdf.\n\n**Examples**\n\n* [Basic usage](examples/basic-usage/main.go)\n* [Converter callbacks](examples/converter-callbacks/main.go)\n* [Convert HTML document based on JSON input](examples/json-input/main.go)\n* [Basic web page to PDF conversion server](examples/http-server)\n* [Configurable web page to PDF conversion server](examples/http-server-advanced)\n\n\u003e Note: The `HTML` to `PDF` conversion (calls to the `Converter.Run` method) must be performed on the main thread.\n\u003e This is a limitation of the `wkhtmltox` library. Please see the `HTTP` server [example](examples/http-server)\n\u003e for more information.\n\n## Prerequisites\n\nIn order to use the package, `wkhtmltox` must be installed. Installation packages\nfor multiple operating systems can be found at [https://builds.wkhtmltopdf.org](https://wkhtmltopdf.org/downloads.html).\n\nPlease see the wiki pages of this project for detailed installation instructions.\n- [Install on Linux](https://github.com/adrg/go-wkhtmltopdf/wiki/Install-on-Linux)\n- [Install on Windows](https://github.com/adrg/go-wkhtmltopdf/wiki/Install-on-Windows)\n\n\u003e Note: `wkhtmltox` does not seem to be actively maintained. Please see the [project status](https://wkhtmltopdf.org/status.html) for more information, recommendations and future plans.\n\n## Installation\n    go get github.com/adrg/go-wkhtmltopdf\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\t\"os\"\n\n\tpdf \"github.com/adrg/go-wkhtmltopdf\"\n)\n\nfunc main() {\n\t// Initialize library.\n\tif err := pdf.Init(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer pdf.Destroy()\n\n\t// Create object from file.\n\tobject, err := pdf.NewObject(\"sample1.html\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tobject.Header.ContentCenter = \"[title]\"\n\tobject.Header.DisplaySeparator = true\n\n\t// Create object from URL.\n\tobject2, err := pdf.NewObject(\"https://google.com\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tobject2.Footer.ContentLeft = \"[date]\"\n\tobject2.Footer.ContentCenter = \"Sample footer information\"\n\tobject2.Footer.ContentRight = \"[page]\"\n\tobject2.Footer.DisplaySeparator = true\n\n\t// Create object from reader.\n\tinFile, err := os.Open(\"sample2.html\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer inFile.Close()\n\n\tobject3, err := pdf.NewObjectFromReader(inFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tobject3.Zoom = 1.5\n\tobject3.TOC.Title = \"Table of Contents\"\n\n\t// Create converter.\n\tconverter, err := pdf.NewConverter()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer converter.Destroy()\n\n\t// Add created objects to the converter.\n\tconverter.Add(object)\n\tconverter.Add(object2)\n\tconverter.Add(object3)\n\n\t// Set converter options.\n\tconverter.Title = \"Sample document\"\n\tconverter.PaperSize = pdf.A4\n\tconverter.Orientation = pdf.Landscape\n\tconverter.MarginTop = \"1cm\"\n\tconverter.MarginBottom = \"1cm\"\n\tconverter.MarginLeft = \"10mm\"\n\tconverter.MarginRight = \"10mm\"\n\n\t// Create output file.\n\toutFile, err := os.Create(\"out.pdf\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer outFile.Close()\n\n\t// Run converter. Due to a limitation of the `wkhtmltox` library, the\n\t// conversion must be performed on the main thread.\n\tif err := converter.Run(outFile); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n\n```\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/adrg/go-wkhtmltopdf.svg)](https://starchart.cc/adrg/go-wkhtmltopdf)\n\n## Contributing\n\nContributions in the form of pull requests, issues or just general feedback,\nare always welcome.  \nSee [CONTRIBUTING.MD](CONTRIBUTING.md).\n\n**Contributors**:\n[adrg](https://github.com/adrg),\n[leandrosilva](https://github.com/leandrosilva),\n[MicahParks](https://github.com/MicahParks).\n\n## References\n\nFor more information see the [wkhtmltopdf documentation](https://wkhtmltopdf.org/usage/wkhtmltopdf.txt)\nand the [wkhtmltox documentation](https://wkhtmltopdf.org/libwkhtmltox).\n\n## License\n\nCopyright (c) 2016 Adrian-George Bostan.\n\nThis project is licensed under the [MIT license](https://opensource.org/licenses/MIT).\nSee [LICENSE](LICENSE) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrg%2Fgo-wkhtmltopdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadrg%2Fgo-wkhtmltopdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadrg%2Fgo-wkhtmltopdf/lists"}