{"id":23427514,"url":"https://github.com/tcrouch/prawn-label_sheet","last_synced_at":"2025-07-21T17:32:08.859Z","repository":{"id":48119077,"uuid":"160260341","full_name":"tcrouch/prawn-label_sheet","owner":"tcrouch","description":"Generate pdf label sheets","archived":false,"fork":false,"pushed_at":"2024-09-05T21:25:32.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-14T01:18:24.794Z","etag":null,"topics":["edtech","labels","labels-generator","pdf-generation","prawn","ruby","stickers"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/tcrouch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-03T22:08:10.000Z","updated_at":"2024-09-05T21:25:31.000Z","dependencies_parsed_at":"2022-08-12T19:00:51.589Z","dependency_job_id":null,"html_url":"https://github.com/tcrouch/prawn-label_sheet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/tcrouch/prawn-label_sheet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcrouch%2Fprawn-label_sheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcrouch%2Fprawn-label_sheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcrouch%2Fprawn-label_sheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcrouch%2Fprawn-label_sheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tcrouch","download_url":"https://codeload.github.com/tcrouch/prawn-label_sheet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tcrouch%2Fprawn-label_sheet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266342809,"owners_count":23914262,"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-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["edtech","labels","labels-generator","pdf-generation","prawn","ruby","stickers"],"created_at":"2024-12-23T06:33:44.790Z","updated_at":"2025-07-21T17:32:08.837Z","avatar_url":"https://github.com/tcrouch.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prawn::LabelSheet\n\n[![Gem Version](https://img.shields.io/gem/v/prawn-label_sheet.svg)](https://rubygems.org/gems/prawn-label_sheet)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/28933c41f8ed4d39a1c96a5895de2343)](https://app.codacy.com/manual/t.crouch/prawn-label_sheet?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=tcrouch/prawn-label_sheet\u0026utm_campaign=Badge_Grade_Dashboard)\n[![Inline docs](http://inch-ci.org/github/tcrouch/prawn-label_sheet.svg?branch=master)](http://inch-ci.org/github/tcrouch/prawn-label_sheet)\n[![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/tcrouch/prawn-label_sheet)\n\nGenerate sets of labels or stickers using Prawn PDF.\n\nFor simple bulk generation, can break page between groups of data.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'prawn-label_sheet'\n```\n\nAnd then execute:\n\n```shell\n$ bundle\n```\n\nOr install it yourself as:\n\n```shell\n$ gem install prawn-label_sheet\n```\n\n## Usage\n\n```ruby\nitems = %w[red orange yellow green blue indigo violet]\n\nPrawn::LabelSheet.generate(\"out.pdf\", items) do |pdf, item|\n  pdf.text_box item\nend\n```\n\nEach item is passed to the block, together with a bounding box for the label.\n\nFor larger sets, page breaks can be inserted on change of value:\n\n```ruby\n# Change in value returned from item[3]\ngenerate(\"out.pdf\", items, break_on: 3)\n\n# Change in value returned from proc\ngenerate(\"out.pdf\", items, break_on: -\u003e(item) { item.downcase })\n```\n\n### Example\n\nIn a school you might want a single document with labels for all students,\nwhere a new sheets is started for each class.\n\nGiven your class data, pre-sorted by [class, last, first]:\n\n```csv\nArthur,Aardvark,1234,Class A\nSam,Smith,1235,Class A\nBob,Bobbington,1236,Class B\nLeah,Lemon,1237,Class B\n```\n\n```ruby\ncsv = CSV.read(\"students.csv\")\n\nPrawn::LabelSheet.generate(\"out.pdf\", csv, break_on: 3) do |pdf, data|\n  last_name, first_name, class_name, student_id = data\n\n  b = pdf.bounds\n  full_width = b.width - 12\n  half_width = (full_width / 2).floor - 1\n\n  pdf.font 'Helvetica'\n\n  pdf.move_down 12\n  pdf.indent(6) do\n    pdf.text_box \"#{last_name} #{first_name}\",\n      at: [b.left, pdf.cursor],\n      width: full_width, height: 12,\n      overflow: :truncate\n  end\n  pdf.move_down 12\n  pdf.stroke_horizontal_rule\n  pdf.move_down 6\n  pdf.font_size 7 do\n    pdf.text_box \"ID\",\n      at: [b.left, pdf.cursor],\n      width: half_width, height: 8\n    pdf.text_box \"Class\",\n      at: [b.right - half_width, pdf.cursor],\n      width: half_width, height: 8\n  end\n  pdf.move_down 9\n  pdf.text_box student_id,\n    at: [b.left, pdf.cursor],\n    width: half_width, height: 10,\n    overflow: :shrink_to_fit\n  pdf.text_box class_name,\n    at: [b.right - half_width, pdf.cursor],\n    width: half_width, height: 10,\n    overflow: :shrink_to_fit\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/tcrouch/prawn-label_sheet.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcrouch%2Fprawn-label_sheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftcrouch%2Fprawn-label_sheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftcrouch%2Fprawn-label_sheet/lists"}