https://github.com/westonganger/prawn_invoice
Dead simple Prawn based PDF invoice generator with support for custom invoice templates
https://github.com/westonganger/prawn_invoice
invoice invoice-builder invoice-generator prawn prawn-pdf rails ruby
Last synced: about 2 months ago
JSON representation
Dead simple Prawn based PDF invoice generator with support for custom invoice templates
- Host: GitHub
- URL: https://github.com/westonganger/prawn_invoice
- Owner: westonganger
- License: mit
- Created: 2019-07-30T19:04:29.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-30T20:30:37.000Z (almost 7 years ago)
- Last Synced: 2025-03-27T19:26:16.146Z (over 1 year ago)
- Topics: invoice, invoice-builder, invoice-generator, prawn, prawn-pdf, rails, ruby
- Language: Ruby
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Prawn Invoice
Dead simple Prawn based PDF invoice generator with support for custom invoice templates
- Dead simple setup and configuration
- Custom Templates
- Optional Rails Integration
# TBD
- Implement the `:default` invoice template
- Document & Finalize template schema implementation
# Usage
```ruby
@data = {}
File.write("path/to/invoice.pdf", wb) do |f|
f.write PrawnInvoice.to_pdf(data: @data)
end
PrawnInvoice.to_pdf_file(filename: "path/to/invoice.pdf", data: @data)
```
Or use in your Rails controllers
```ruby
class InvoiceController < ApplicationController
def index
@data = {}
render pdf: PrawnInvoice.to_pdf(data: @data)
end
```
# Custom Templates
Custom invoice templates classes can be implemented as required.
Use the `:default` template class as an example:
https://github.com/westonganger/prawn_resume/blob/master/lib/prawn_resume/templates/default.rb
Once implemented use it like so:
```ruby
PrawnInvoice.to_pdf(data: @data, template: :default)
# OR
PrawnInvoice.to_pdf(data: @data, template: PrawnInvoice::Templates::Default)
```
# Credits
Created & Maintained by [Weston Ganger](https://westonganger.com) - [@westonganger](https://github.com/westonganger)
For any consulting or contract work please contact me via my company website: [Solid Foundation Web Development](https://solidfoundationwebdev.com)
[](https://solidfoundationwebdev.com)