{"id":18438043,"url":"https://github.com/boxesandglue/bagme","last_synced_at":"2025-06-15T09:08:58.666Z","repository":{"id":64299683,"uuid":"567177256","full_name":"boxesandglue/bagme","owner":"boxesandglue","description":"boxes and glue made easy - a PDF rendering library for Go using boxes and glue","archived":false,"fork":false,"pushed_at":"2024-10-14T19:16:20.000Z","size":97,"stargazers_count":82,"open_issues_count":1,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-20T15:06:22.683Z","etag":null,"topics":["css","go","html","pdf","pdf-generation"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boxesandglue.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","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":"2022-11-17T08:33:03.000Z","updated_at":"2025-05-18T05:23:16.000Z","dependencies_parsed_at":"2024-06-21T15:35:01.284Z","dependency_job_id":"2f33e390-2c43-4a48-b671-3027223d97db","html_url":"https://github.com/boxesandglue/bagme","commit_stats":null,"previous_names":["boxesandglue/bagme","speedata/bagme"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/boxesandglue/bagme","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxesandglue%2Fbagme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxesandglue%2Fbagme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxesandglue%2Fbagme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxesandglue%2Fbagme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxesandglue","download_url":"https://codeload.github.com/boxesandglue/bagme/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxesandglue%2Fbagme/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259949680,"owners_count":22936411,"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":["css","go","html","pdf","pdf-generation"],"created_at":"2024-11-06T06:18:01.836Z","updated_at":"2025-06-15T09:08:58.654Z","avatar_url":"https://github.com/boxesandglue.png","language":"Go","funding_links":[],"categories":["Template Engines"],"sub_categories":["HTTP Clients"],"readme":"** This library is currently under development and not yet ready for production use. **\n\n# bagme - boxes and glue made easy\n\nbagme is a PDF library to format HTML fragments styled with CSS using the (pure Go) “[boxes and glue](https://boxesandglue.dev)” library.\nboxes and glue implements TeX's typesetting algorithms, so the idea is to get superb HTML rendering with almost no effort.\n\nThe goal is to have a PDF rendering engine for your Go software without having to do a lot of programming.\n\n\n## Sample code\n\n\u003cimg src=\"https://i.imgur.com/rGWsP8h.png\" alt=\"typeset text from the frog king\" width=\"500\"/\u003e\n\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/boxesandglue/bagme/document\"\n\t\"github.com/boxesandglue/boxesandglue/backend/bag\"\n)\n\nvar html = `\u003ch1\u003eThe frog king\u003c/h1\u003e\n\n\u003cp\u003eIn olden times when wishing still \u003cem\u003ehelped\u003c/em\u003e one,\n   there lived a king whose daughters were all beautiful,\n   but the \u003cspan class=\"green\"\u003eyoungest\u003c/span\u003e was so beautiful that the sun itself,\n   which has seen so much, was\n   \u003cspan style=\"font-weight: bold\"\u003eastonished\u003c/span\u003e whenever it\n   shone in her face.\u003c/p\u003e\n\n\u003cp\u003eClose by the king's castle lay a great dark forest,\n\tand under an old lime-tree in the forest was a well,\n\tand when the day was very warm, the king's child\n\twent out into the forest and sat down by the side of\n\tthe cool \u003cspan id=\"important\"\u003efountain\u003c/span\u003e, and when she was bored she took a\n\tgolden ball, and threw it up on high and caught it,\n\tand this ball was her favorite plaything.\n\u003c/p\u003e`\n\nvar css = `\nbody {\n\tfont-family: serif;\n    font-size: 12pt;\n    line-height: 14pt;\n}\n\np {\n    margin-top: 8pt;\n    margin-bottom: 2pt;\n}\n\n.green {\n    color: green;\n}\n\n#important {\n    color: rebeccapurple;\n    font-weight: bolder;\n    font-style: italic;\n}`\n\nfunc dothings() error {\n\td, err := document.New(\"out.pdf\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif d.AddCSS(css); err != nil {\n\t\treturn err\n\t}\n\t// loads the font families serif, sans and monospace\n\tif err = d.Frontend.LoadIncludedFonts(); err != nil {\n\t\treturn err\n\t}\n\twd := bag.MustSP(\"280pt\")\n\tcolText := bag.MustSP(\"140pt\")\n\tcolImage := bag.MustSP(\"20pt\")\n\trowText := bag.MustSP(\"23cm\")\n\tif err = d.OutputAt(html, wd, colText, rowText); err != nil {\n\t\treturn err\n\t}\n\n\tif err = d.OutputAt(`\u003cimg src=\"img/frogking-a.pdf\" width=\"4cm\" height=\"6cm\"\u003e`, wd, colImage, rowText); err != nil {\n\t\treturn err\n\t}\n\treturn d.Finish()\n}\n\nfunc main() {\n\tif err := dothings(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n## Limitations\n\n* No automatic page breaks: you have to take care of your items on the page.\n* Limited HTML/CSS support: some things are implemented, most are not.\n\n\n## Other\n\nContact: \u003cgundlach@speedata.de\u003e\u003cbr\u003e\nLicense: New BSD License\u003cbr\u003e\nStatus: Beta: You can try it, but expect API changes.\u003cbr\u003e\nMastodon: [boxesandglue@typo.social](https://typo.social/@boxesandglue)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxesandglue%2Fbagme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxesandglue%2Fbagme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxesandglue%2Fbagme/lists"}