{"id":13700903,"url":"https://github.com/balacode/one-file-pdf","last_synced_at":"2026-02-04T05:16:37.674Z","repository":{"id":57492970,"uuid":"123580353","full_name":"balacode/one-file-pdf","owner":"balacode","description":"A minimalist Go PDF writer in 1982 lines. Draws text, images and shapes. Helps understand the PDF format. Used in production for reports.","archived":false,"fork":false,"pushed_at":"2021-06-08T14:23:49.000Z","size":1358,"stargazers_count":483,"open_issues_count":4,"forks_count":15,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-08-14T01:28:31.333Z","etag":null,"topics":["go","golang","graphics","minimalism","pdf","pdf-generation","printing"],"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/balacode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-02T13:08:47.000Z","updated_at":"2025-06-24T19:55:09.000Z","dependencies_parsed_at":"2022-08-28T13:41:47.386Z","dependency_job_id":null,"html_url":"https://github.com/balacode/one-file-pdf","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/balacode/one-file-pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balacode%2Fone-file-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balacode%2Fone-file-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balacode%2Fone-file-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balacode%2Fone-file-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balacode","download_url":"https://codeload.github.com/balacode/one-file-pdf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balacode%2Fone-file-pdf/sbom","scorecard":{"id":224287,"data":{"date":"2025-08-11","repo":{"name":"github.com/balacode/one-file-pdf","commit":"6d3753730cb9184a9c80d710f7b8784b8539733e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T03:19:58.992Z","repository_id":57492970,"created_at":"2025-08-17T03:19:58.992Z","updated_at":"2025-08-17T03:19:58.992Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29070361,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"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":["go","golang","graphics","minimalism","pdf","pdf-generation","printing"],"created_at":"2024-08-02T20:01:06.664Z","updated_at":"2026-02-04T05:16:37.650Z","avatar_url":"https://github.com/balacode.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"## one-file-pdf - A minimalist PDF generator in \u0026lt;2K lines and 1 file\n[![Go Report Card](https://goreportcard.com/badge/github.com/balacode/one-file-pdf)](https://goreportcard.com/report/github.com/balacode/one-file-pdf)\n[![Build Status](https://travis-ci.org/balacode/one-file-pdf.svg?branch=master)](https://travis-ci.org/balacode/one-file-pdf)\n[![Test Coverage](https://coveralls.io/repos/github/balacode/one-file-pdf/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/balacode/one-file-pdf?branch=master)\n[![Gitter chat](https://badges.gitter.im/balacode/one-file-pdf.png)](https://gitter.im/one-file-pdf/Lobby)\n[![godoc](https://godoc.org/github.com/balacode/one-file-pdf?status.svg)](https://godoc.org/github.com/balacode/one-file-pdf)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)    \n\nThe main idea behind this project was:  \n*\"How small can I make a PDF generator for it to still be useful for 80% of common PDF generation needs?\"*\n\nThe result is a single .go file with less than 1999 lines of code, about 400 of which are color and glyph-size constants, and ~350 are comments.\n\n- It's easier to learn about the internals of the PDF format with a small, concise library.\n- The current version of the file is indicated in the header (the timestamp).\n\n## Features:  \n- The essentials for generating PDF documents, sufficient for common business reports.\n- Use all built-in PDF fonts: Courier, Helvetica, Symbol, Times, ZapfDingbats, and their variants\n- Specify colo(u)rs by name (144 web colors), HTML codes (#RRGGBB) or RGB value\n- Set columns for text (like tab stops on the page)\n- Built-in grid option to help measurement and positioning\n- Metadata properties: author, creator, keywords, subject and title\n- Set the measurement units you want: mm, cm, inches, twips or points\n- Draw lines with different thickness\n- Filled or outline rectangles, circles and ellipses\n- JPEG, GIF and transparent PNG images (filled with specified background color)\n- Stream compression can be turned on or off (PDF files normally compress streams to reduce file size, but turning it off helps in debugging or learning about PDF commands)\n\n## Not Yet Supported:  \n- Unicode (requires font embedding)\n- Font embedding\n- PDF encryption\n- Paths, curves and complex graphics\n\n## Installation:  \n\n```bash\n    go get github.com/balacode/one-file-pdf\n```\n\n## Naming Convention:  \nAll types in are prefixed with PDF for public, and 'pdf' for private types.\nThe only type you need to use is PDF, while PDFColorNames are left public for reference.\n\n## Hello World:  \n\n```go\npackage main \n\nimport (\n\t\"fmt\"\n\t\"github.com/balacode/one-file-pdf\"\n)\n\nfunc main() {\n    fmt.Println(`Generating a \"Hello World\" PDF...`)\n\n    // create a new PDF using 'A4' page size\n    var pdf = pdf.NewPDF(\"A4\")\n\n    // set the measurement units to centimeters\n    pdf.SetUnits(\"cm\")\n\n    // draw a grid to help us align stuff (just a guide, not necessary)\n    pdf.DrawUnitGrid()\n\n    // draw the word 'HELLO' in orange, using 100pt bold Helvetica font\n    // - text is placed on top of, not below the Y-coordinate\n    // - you can use method chaining\n    pdf.SetFont(\"Helvetica-Bold\", 100).\n        SetXY(5, 5).\n        SetColor(\"Orange\").\n        DrawText(\"HELLO\")\n\n    // draw the word 'WORLD' in blue-violet, using 100pt Helvetica font\n    // note that here we use the colo(u)r hex code instead\n    // of its name, using the CSS/HTML format: #RRGGBB\n    pdf.SetXY(5, 9).\n        SetColor(\"#8A2BE2\").\n        SetFont(\"Helvetica\", 100).\n        DrawText(\"WORLD!\")\n\n    // draw a flower icon using 300pt Zapf-Dingbats font\n    pdf.SetX(7).SetY(17).\n        SetColorRGB(255, 0, 0).\n        SetFont(\"ZapfDingbats\", 300).\n        DrawText(\"a\")\n\n    // save the file:\n    // if the file exists, it will be overwritten\n    // if the file is in use, prints an error message\n    pdf.SaveFile(\"hello.pdf\")\n} //                                                                        main\n```\n\n## Samples:\nClick on a sample to see the PDF in more detail.\n\n[![\"Hello World!\" sample image](demo/samples/hello.png)](demo/samples/hello.pdf)  \n\n[![\"Synergy Ipsum\" sample image](demo/samples/corporate.png)](demo/samples/corporate.pdf)  \n\n## Changelog:  \n\nThese are the most recent changes in the functionality of the package,\nnot including internal changes which are best seen in the commits history.\n\n**2018-04-14**\n- Changed CurrentPage from read-only to read/write property: added SetCurrentPage()\n- Created PageCount() read-only property\n- Created dingbats() demo to generate `zapf_dingbats_table.pdf`.\n  You can use this table to look up the hex code for each icon.\n- Changed text encoding from /WinAnsiEncoding to /StandardEncoding\n\nSee [changelog.md](./doc/changelog.md) for changes made earlier.\n\n## Roadmap:  \n\n- Achieve 100% test coverage\n- Create a unit test for every method\n- Unicode support\n- Partial font embedding\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalacode%2Fone-file-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalacode%2Fone-file-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalacode%2Fone-file-pdf/lists"}