{"id":35232383,"url":"https://github.com/famoser/pdf-generator","last_synced_at":"2026-04-02T02:07:57.959Z","repository":{"id":34059011,"uuid":"168019117","full_name":"famoser/pdf-generator","owner":"famoser","description":"fast pdf generation with a high-level api","archived":false,"fork":false,"pushed_at":"2026-01-31T15:16:38.000Z","size":38211,"stargazers_count":17,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-01T03:14:14.562Z","etag":null,"topics":["packagist","pdf-generation","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/famoser.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-28T19:05:20.000Z","updated_at":"2026-01-31T15:16:42.000Z","dependencies_parsed_at":"2024-01-01T12:33:20.214Z","dependency_job_id":"97e32603-7b88-4cbc-ba04-6da58d499281","html_url":"https://github.com/famoser/pdf-generator","commit_stats":{"total_commits":309,"total_committers":4,"mean_commits":77.25,"dds":"0.42071197411003236","last_synced_commit":"02cae58d702ae4c58d4e13b65f45efaf4929cad3"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/famoser/pdf-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famoser%2Fpdf-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famoser%2Fpdf-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famoser%2Fpdf-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famoser%2Fpdf-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/famoser","download_url":"https://codeload.github.com/famoser/pdf-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/famoser%2Fpdf-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31294398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:43:37.129Z","status":"online","status_checked_at":"2026-04-02T02:00:08.535Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["packagist","pdf-generation","php"],"created_at":"2025-12-30T03:02:08.850Z","updated_at":"2026-04-02T02:07:57.520Z","avatar_url":"https://github.com/famoser.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pdf-generator\n\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![PHP Composer](https://github.com/famoser/pdf-generator/actions/workflows/php.yml/badge.svg)](https://github.com/famoser/pdf-generator/actions/workflows/php.yml)\n\n## About\n\nGenerates pdf files without any dependencies. Includes a layout engine to handle flow content (e.g. text spanning over\nmore than one page).\n\n```bash\ncomposer require famoser/pdf-generator\n```\n\nThis is still under active development ([contributions welcome!](./CONTRIBUTE.md)), and the public API is subject to\nchange. If you are looking for a more mature project, see https://github.com/tecnickcom/TCPDF.\n\n## Getting started\n\nUsing the printer:\n\n```php\n// places \"Hello world\" in the top-left corner of the document.\n$document = new Document();\n$printer = $document-\u003ecreatePrinter();\n\n$bodyText = new TextStyle(Font::createFromDefault());\n$printer-\u003eprintText('Hello world', $bodyText);\n\nfile_put_contents('example.pdf', $document-\u003esave());\n```\n\nThe printer is useful when the exact position of elements is known. For example, for correspondence with fixed layout \n(e.g. the address in a letter) or for documents with page numbers. However, for many elements (such as tables)\ndetermining the exact position is cumbersome. For this, layouts are provided.\n\nUsing layouts:\n\n```php\n// adds a rectangle, followed by \"Hello moon\".\n// placement is decided by Flow, which places elements one-after-the-other.\n$flow = new Flow();\n\n$rectangle = new Rectangle(width: 120, height: 80, style: new DrawingStyle());\n$flow-\u003eaddContent($rectangle);\n\n$text = new Text();\n$text-\u003eaddSpan('Hello moon', $bodyText);\n$flow-\u003eadd($text);\n\n$document-\u003eadd($flow);\n\nfile_put_contents('example.pdf', $document-\u003esave());\n```\n\nThe layouts allow to declare *what* needs to be printed, and then takes care of the *where*. Provided are flows, grids, \ntables and text.\n\n## Examples\n\n### Invoice\n\n[Code](./examples/invoice.php) | [.pdf](./examples/invoice.pdf)\n\u003ctable\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\u003cimg src=\"examples/invoice.png?raw=true\" alt=\"Invoice\"\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\n### Book\n\n[Code](./examples/book.php) | [.pdf](./examples/book.pdf)\n\n\u003ctable\u003e\n    \u003ctbody\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\u003cimg src=\"examples/book_1.png?raw=true\" alt=\"Book page 1\"\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003cimg src=\"examples/book_2.png?raw=true\" alt=\"Book page 2\"\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n        \u003ctr\u003e\n            \u003ctd\u003e\u003cimg src=\"examples/book_3.png?raw=true\" alt=\"Book page 3\"\u003e\u003c/td\u003e\n            \u003ctd\u003e\u003cimg src=\"examples/book_4.png?raw=true\" alt=\"Book page 4\"\u003e\u003c/td\u003e\n        \u003c/tr\u003e\n    \u003c/tbody\u003e\n\u003c/table\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffamoser%2Fpdf-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffamoser%2Fpdf-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffamoser%2Fpdf-generator/lists"}