To generate a document, instantiate Receipts::Receipt, Receipts::Invoice, or Receipts::Statement with a configuration hash. You can then use .render to get the raw PDF string or .render_file to save it to disk.
r = Receipts::Receipt.new(
details: [
["Receipt Number", "123"],
["Date paid", Date.today]
],
company: {
name: "Example, LLC",
address: "123 Fake Street\nNew York City, NY 10012",
email: "support@example.com",
logo: File.expand_path("./logo.png")
},
recipient: [
"Customer",
"Their Address",
"City, State Zipcode",
nil,
"customer@example.org"
],
line_items: [
["<b>Item</b>", "<b>Unit Cost</b>", "<b>Quantity</b>", "<b>Amount</b>"],
["Subscription", "$19.00", "1", "$19.00"]
],
footer: "Thanks for your business."
)
# Returns a string of the raw PDF
r.render
# Writes the PDF to disk
r.render_file "examples/receipt.pdf"