{"id":13581137,"url":"https://github.com/txn2/txpdf","last_synced_at":"2025-04-11T03:20:57.644Z","repository":{"id":108855818,"uuid":"139355023","full_name":"txn2/txpdf","owner":"txn2","description":"HTML to PDF microservice","archived":false,"fork":false,"pushed_at":"2023-07-24T04:54:38.000Z","size":513,"stargazers_count":92,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T01:03:18.265Z","etag":null,"topics":["docker","docker-image","golang-application","golang-server","microservice","pdf","pdf-files","pdf-generation","webapi","wkhtmltopdf"],"latest_commit_sha":null,"homepage":"https://mk.imti.co/webpage-to-pdf-microservice/","language":"XSLT","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/txn2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-07-01T19:12:27.000Z","updated_at":"2024-10-20T11:58:33.000Z","dependencies_parsed_at":"2024-01-17T15:02:55.715Z","dependency_job_id":"cdb482bf-76b7-4f96-8a17-73f02d100489","html_url":"https://github.com/txn2/txpdf","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxpdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxpdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxpdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/txn2%2Ftxpdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/txn2","download_url":"https://codeload.github.com/txn2/txpdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248334036,"owners_count":21086304,"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":["docker","docker-image","golang-application","golang-server","microservice","pdf","pdf-files","pdf-generation","webapi","wkhtmltopdf"],"created_at":"2024-08-01T15:01:58.453Z","updated_at":"2025-04-11T03:20:57.622Z","avatar_url":"https://github.com/txn2.png","language":"XSLT","funding_links":[],"categories":["XSLT","webapi"],"sub_categories":[],"readme":"![](https://raw.githubusercontent.com/txn2/txpdf/master/assets/mast.jpg)\n\n[![](https://images.microbadger.com/badges/image/txn2/txpdf.svg)](https://microbadger.com/images/txn2/txpdf \"n2pdf\")\n[![Docker Container Pulls](https://img.shields.io/docker/pulls/txn2/txpdf.svg)](https://hub.docker.com/r/txn2/txpdf/)\n\n\n# txPDF\n\nCheck out the article [Webpage to PDF Microservice](https://mk.imti.co/webpage-to-pdf-microservice/) for a quick getting started guide.\n\n[txPDF] is an HTML to PDF microservice by [txn2]. [txPDF] is built on top of the [n2pdf] container exposing an API endpoint that returns a PDF document from web based **POST** request.\n\nExample Post Body:\n```json\n{\n  \"options\": {\n    \"print_media_type\": true\n  },\n  \"pages\": [\n    {\n      \"Location\": \"https://www.example.com\"\n    }\n  ]\n}\n```\n\nIf you want to convert web pages to PDF but do not need a web service you can use the [n2pdf] container directly as a command line tool.\n\n## Security\n\n[txPDF] is intended as a backend service and should only be accessible by other trusted services. [txPDF] allows the passing of template directives that can access environment or request data. This is useful and make\n[txPDF] highly flexible. However please treat [txPDF] as a remote code executor and implement it accordingly. See [#2](https://github.com/txn2/txpdf/issues/2) \nfor more on this issue.\n\n## Docker Use\n\nRun the [txPDF Docker container] on your local workstation for testing. Forward port **8080** or any free port to txPDFs default service port **8080** on the container.\n\n```bash\ndocker run --rm -p 8080:8080 -e IP=0.0.0.0 txn2/txpdf:2.0.2\n```\n\n## Curl Test\n```bash\ncurl -d \"@examples/days.json\" -X POST http://localhost:8080/getPdf --output test.pdf\n```\n\n[txPDF] can be configured with the following environment variables:\n\n| Variable | Default | Purpose |\n| -------- | ------- | ------- |\n| IP | 127.0.0.1 | Bind IP address |\n| PORT | 8080 | Server listen port |\n| DEBUG | false | Verbose logging |\n| TOC_XSL | | Path to XSL transformation script for Table of Contents (example **./toc.xsl**. Container holds a default **./toc.xsl** |\n\n## Test\n\n```bash\ncurl -d \"@examples/multi-site.json\" -X POST http://localhost:8080/getPdf --output test.pdf\n```\n\n\n[n2pdf]:https://github.com/txn2/n2pdf\n[txPDF]:https://github.com/txn2/txpdf\n[txn2]:https://github.com/txn2\n[txPDF Docker container]:https://hub.docker.com/r/txn2/txpdf/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxn2%2Ftxpdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftxn2%2Ftxpdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftxn2%2Ftxpdf/lists"}