Skip to content

Dead simple Prawn based PDF invoice generator with support for custom invoice templates

License

Notifications You must be signed in to change notification settings

westonganger/prawn_invoice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prawn Invoice

Gem Version Build Status RubyGems Downloads Buy Me a Coffee

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

@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

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:

PrawnInvoice.to_pdf(data: @data, template: :default)

# OR

PrawnInvoice.to_pdf(data: @data, template: PrawnInvoice::Templates::Default)

Credits

Created & Maintained by Weston Ganger - @westonganger

For any consulting or contract work please contact me via my company website: Solid Foundation Web Development

Solid Foundation Web Development Logo

About

Dead simple Prawn based PDF invoice generator with support for custom invoice templates

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages