{"id":13413517,"url":"https://github.com/hyperboloide/pdfgen","last_synced_at":"2026-02-01T14:07:59.312Z","repository":{"id":57496887,"uuid":"47140910","full_name":"hyperboloide/pdfgen","owner":"hyperboloide","description":"HTTP service to generate PDF from Json requests","archived":false,"fork":false,"pushed_at":"2018-02-19T15:49:42.000Z","size":2301,"stargazers_count":70,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-07-31T20:52:32.484Z","etag":null,"topics":["pdf"],"latest_commit_sha":null,"homepage":"","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/hyperboloide.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}},"created_at":"2015-11-30T19:27:26.000Z","updated_at":"2024-04-18T21:39:19.000Z","dependencies_parsed_at":"2022-09-03T02:30:53.663Z","dependency_job_id":null,"html_url":"https://github.com/hyperboloide/pdfgen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hyperboloide/pdfgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperboloide%2Fpdfgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperboloide%2Fpdfgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperboloide%2Fpdfgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperboloide%2Fpdfgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperboloide","download_url":"https://codeload.github.com/hyperboloide/pdfgen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperboloide%2Fpdfgen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28980193,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T13:38:33.235Z","status":"ssl_error","status_checked_at":"2026-02-01T13:38:32.912Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["pdf"],"created_at":"2024-07-30T20:01:42.187Z","updated_at":"2026-02-01T14:07:59.288Z","avatar_url":"https://github.com/hyperboloide.png","language":"Go","readme":"# pdfgen\n[![Build Status](https://travis-ci.org/hyperboloide/pdfgen.svg?branch=master)](https://travis-ci.org/hyperboloide/pdfgen)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hyperboloide/pdfgen)](https://goreportcard.com/report/github.com/hyperboloide/pdfgen)\n\n\nHTTP service to generate PDF from Json requests\n\n## Install and run\n\nThe recommended method is to use the docker container by mounting your template\ndirectory (here with the provided example `template` directory):\n\n```\ndocker run --rm -it -p 8888:8888 \\\n  --mount src=my_templates/,target=/etc/pdfgen/templates,type=bind \\\n  hyperboloide/pdfgen\n```\n\nIf you rather not using Docker, you need to install [wkhtmltopdf](https://wkhtmltopdf.org/downloads.html)\nfirst, then run:\n```\ngo install github.com/hyperboloide/pdfgen\nPDFGEN_TEMPLATES=./templates pdfgen\n```\n\nOnce installed you can test with something like this:\n```\ncurl -H \"Content-Type: application/json\" -X POST -d @my_json_file.json \\\n  http://localhost:8888/invoice \u003e result.pdf\n```\n\nNote that the rendering may differ depending on your os (especially OSX) and installed fonts,\nthat's why it is recommended to test and develop on the Docker environment to\nget the same result in production.\n\n## Templates\n\nThe PDF are generated from HTML templates. These templates closely ressemble [Django Templates](https://docs.djangoproject.com/en/1.9/ref/templates/language/).\n\nthe following template:\n```html\n\u003ch1\u003eHello, {{ user }}\u003c/h1\u003e\n```\n\ncan be generated with a `application/json` POST request:\n\n```json\n{\"user\": \"fred\"}\n```\n\nThe response is of type `application/pdf` and contains the resulting PDF.\n\nEach PDF template should be in it's own directory under the root directory\ndefined in the `PDFGEN_TEMPLATES` environment variable.\n\nThe urls endpoints will be generated from these directories names. For example a template\nin the directory `invoice` will be a reachable at a url that look like that: `http://host:port/invoice`\n\nThe template directory must contain an `index.html` file and optionnaly\na `footer.html` file. Other assets like images and CSS should be in\nthat directory too.\nNote that each PDF is generated in isolation and so\nyour templates should use absolutes paths.\nFor example if you use bower and have a path like that:\n`invoices/bower_components/`\nyou should have:\n\n```html\n\u003clink rel=\"stylesheet\" href=\"/bower_components/bootstrap/dist/css/bootstrap.min.css\" media='screen,print'\u003e\n```\n\nFinally don't forget to set the `PDFGEN_TEMPLATES` env variable to the path of\nyour templates parent directory\nAlternatively you copy your templates to either :\n`/etc/pdfgen/templates` or `~/.templates`.\n\n## Adding fonts\n\nYou could just create a new container with your fonts and rebuild the\ncache. Bellow an example Dockerfile.\n\n```\nFROM hyperboloide/pdfgen\nCOPY my_fonts /usr/local/share/fonts/\nRUN  fc-cache -f -v\n```\n","funding_links":[],"categories":["Microsoft Office","Miscellaneous","杂项","其他杂项","Uncategorized","其他"],"sub_categories":["Uncategorized","Strings","Advanced Console UIs","未分类的","暂未分类","暂未分类这些库被放在这里是因为其他类别似乎都不适合。","交流"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperboloide%2Fpdfgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperboloide%2Fpdfgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperboloide%2Fpdfgen/lists"}