{"id":17548471,"url":"https://github.com/nerdgeschoss/pixelpress","last_synced_at":"2025-04-14T00:43:48.602Z","repository":{"id":56888173,"uuid":"82565309","full_name":"nerdgeschoss/pixelpress","owner":"nerdgeschoss","description":"PDF printing and previewing for Rails","archived":false,"fork":false,"pushed_at":"2024-10-18T13:02:31.000Z","size":66,"stargazers_count":11,"open_issues_count":2,"forks_count":1,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-12-19T14:34:12.185Z","etag":null,"topics":["mailer","pdf","rails","ruby","weasyprint"],"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/nerdgeschoss.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-20T14:12:30.000Z","updated_at":"2024-10-18T13:01:59.000Z","dependencies_parsed_at":"2024-10-22T04:10:53.541Z","dependency_job_id":null,"html_url":"https://github.com/nerdgeschoss/pixelpress","commit_stats":{"total_commits":42,"total_committers":8,"mean_commits":5.25,"dds":0.4285714285714286,"last_synced_commit":"0d6d1eb4468e0b627968ca5b5cb205edef703a0a"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdgeschoss%2Fpixelpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdgeschoss%2Fpixelpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdgeschoss%2Fpixelpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nerdgeschoss%2Fpixelpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nerdgeschoss","download_url":"https://codeload.github.com/nerdgeschoss/pixelpress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804721,"owners_count":21164127,"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":["mailer","pdf","rails","ruby","weasyprint"],"created_at":"2024-10-21T02:07:42.069Z","updated_at":"2025-04-14T00:43:48.579Z","avatar_url":"https://github.com/nerdgeschoss.png","language":"Ruby","readme":"# Pixelpress\n\nModeled after `ActionMailer`, this gem allows you to render PDFs from HTML via Rails' templating engine. Additionally, you can preview your PDF templates via a supplied Rails engine during development.\n\n## Installation\n\nAdd Pixelpress to your application's Gemfile:\n\n```ruby\ngem \"pixelpress\"\n```\n\nAnd then execute:\n\n```bash\n$ bundle\n```\n\nYou'll also need [WeasyPrint](https://weasyprint.org/). It needs to be installed and added to your `PATH`, so that `which weasyprint` returns the location of the binary. Read their installation instructions here: https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation\n\n## Usage\n\nRun the printer generator providing the name of your printer with methods to be generated:\n```bash\nrails generate pixelpress:printer NAME [method_name1 method_name2 ...] [options]\n```\n\nThis creates the new printer in `app/printers`. If you run it the first time, it will also add an `ApplicationPrinter` and mount the Rails engine in your `config/routes.rb` file.\n\n**Example**\n\n```bash\n$ rails g pixelpress:printer invoice customer_invoice delivery_document\n```\n\nwill generate an `app/printers/invoice_printer.rb` file with this content:\n\n```ruby\nclass InvoicePrinter \u003c ApplicationPrinter\n  def customer_invoice\n    # put your code here\n  end\n\n  def delivery_document\n    # put your code here\n  end\nend\n```\n\nThe command will also generate corresponding templates  as `.pdf.erb` files located in `app/views/printers/invoice/`:\n\n- `customer_invoice.pdf.erb`\n- `delivery_document.pdf.erb`\n\nYou can preview your documents by running `rails s` and go to\n\n```\nhttp://localhost:3000/rails/printers\n```\n\nTo use your printers in code, you can use them similarly to how you'd use mailers:\n\n```ruby\nInvoicePrinter.customer_invoice.pdf # render a temporary pdf file\nInvoicePrinter.customer_invoice.html # get the rendered document in html format\n```\n\nSo you can send them to the client via a controller action:\n\n```ruby\nclass InvoicesController \u003c ApplicationController\n  def show\n    document = InvoicePrinter.customer_invoice\n    respond_to do |format|\n      format.html { render html: document.html }\n      format.pdf { send_data document.pdf.read, disposition: 'inline', type: 'application/pdf' }\n    end\n  end\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/Alex/pixelpress.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdgeschoss%2Fpixelpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnerdgeschoss%2Fpixelpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnerdgeschoss%2Fpixelpress/lists"}