{"id":31757035,"url":"https://github.com/vexcited/pagiko","last_synced_at":"2025-10-09T19:46:53.208Z","repository":{"id":313872355,"uuid":"1044349294","full_name":"Vexcited/Pagiko","owner":"Vexcited","description":"PDF generation library that feels like home. Make PDFs the way you build UIs thanks to Tailwind and Flexbox.","archived":false,"fork":false,"pushed_at":"2025-09-24T06:56:22.000Z","size":71,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-24T08:39:17.479Z","etag":null,"topics":["flexbox","pdf","pdf-generation","pdf-lib","tailwind","typescript","yoga-layout"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Vexcited.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-25T14:49:19.000Z","updated_at":"2025-09-24T06:56:26.000Z","dependencies_parsed_at":"2025-09-09T10:00:01.669Z","dependency_job_id":"c1b51424-6b80-4ea6-ba79-36cf5ff06265","html_url":"https://github.com/Vexcited/Pagiko","commit_stats":null,"previous_names":["vexcited/pagiko"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Vexcited/Pagiko","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FPagiko","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FPagiko/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FPagiko/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FPagiko/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vexcited","download_url":"https://codeload.github.com/Vexcited/Pagiko/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vexcited%2FPagiko/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001960,"owners_count":26083244,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"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":["flexbox","pdf","pdf-generation","pdf-lib","tailwind","typescript","yoga-layout"],"created_at":"2025-10-09T19:46:51.875Z","updated_at":"2025-10-09T19:46:53.199Z","avatar_url":"https://github.com/Vexcited.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pagiko\n\n## Installation\n\n```sh\nbun add pagiko\n```\n\n## Quick Start\n\nYou can quickly get started by creating an empty PDF.\n\n```typescript\nimport { pdf, page } from \"pagiko\";\nconst file = pdf().child(page());\n```\n\nHere, we created a PDF document with a single page.\nOnce you've done with your layout, you can render the file into bytes.\n\n```typescript\nconst bytes = await file.renderToBytes();\n//    ^ UInt8Array\n```\n\nWith those bytes, you can write the file to your filesystem for example.\n\n```typescript\nimport { writeFile } from \"node:fs/promises\";\nawait writeFile(\"document.pdf\", bytes);\n```\n\nBut since this library also works in browsers, you can use whatever method\nyou like to display or download the PDF depending on your needs.\n\n## API\n\n### `pdf()` - create a new document\n\n#### `.author()` - set the author of the document\n\nSet document's author metadata.\nThe author will appear in the document properties section of most PDF readers.\n\n```typescript\npdf().author(\"Vexcited\");\n```\n\n#### `.font()` - load a font to later use\n\nThis will add the font to the document, needed when you want to use a\ncustom font later on. The default font is Helvetica.\n\n```typescript\nimport { pdf, font, StandardFonts } from \"pagiko\";\nconst times = font(StandardFonts.TimesRoman);\n\nconst buffer = new Uint8Array(/* ...a font file... */);\nconst custom = font(buffer);\n\n// Load both fonts to be later used.\npdf().font(times).font(custom);\n```\n\n#### `.child()` - add a new page to document\n\nJust like a tree, if you want to add pages to your document,\nyou must use `child` for each page.\n\n```typescript\nimport { page } from \"pagiko\";\n\npdf()\n  .child(page()) // Page 1\n  .child(page()); // Page 2\n```\n\n### `page()` - create a new page\n\n#### `.h()` - set the height\n\nDefine a new height for the page, provided in `pt`. \\\nDefaults to `841.89` which is the height in `pt` for an A4.\n\n```typescript\npage().h(100.5);\n```\n\n#### `.w()` - set the width\n\nDefine a new width for the page, provided in `pt`. \\\nDefaults to `595.28` which is the width in `pt` for an A4.\n\n```typescript\npage().w(200.25);\n```\n\n#### `.size()` - set the width and height at the same time\n\nDefine a new width and height for the page, provided in `pt`. \\\nDefaults to `[595.276, 841.8898]` which the width and height in `pt` for an A4.\n\n```typescript\nimport { PageSizes } from \"pagiko\";\n\npage().size([200.25, 100.5]);\npage().size(PageSizes.A7);\n```\n\n#### `.child()` - add elements to the page\n\nAdd elements to the root of the page, you can chain this function\nto add multiple elements to the root.\n\n```typescript\nimport { div, text } from \"pagiko\";\n\npage\n  .child(div()) // Add an empty div to the page\n  .child(text(\"\")); // Add an empty text to the page\n```\n\n## Contributing\n\n### Quick Start\n\n```sh\ngit clone https://github.com/Vexcited/Pagiko \u0026\u0026 cd Pagiko\n\nbun install\nbun run ./examples/... # run any example!\n```\n\n### Release\n\nI am using [Mentor](https://github.com/Vexcited/Mentor) to automatically\ncreate releases for this package.\n\n```sh\nmentor\n```\n\nWe're using semver for versioning.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvexcited%2Fpagiko","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvexcited%2Fpagiko","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvexcited%2Fpagiko/lists"}