README.md in invoice_printer-1.0.0 vs README.md in invoice_printer-1.1.0.rc1
- old
+ new
@@ -2,17 +2,17 @@
<img src="./docs/web/logo.png" width="300" />
</a>
-Super simple PDF invoicing in pure Ruby (based on Prawn library).
+Super simple PDF invoicing in pure Ruby
-InvoicePrinter does not impose any validations nor calculations on you. It is
-designed only to provide an interface to build the PDF version of these documents.
+InvoicePrinter is a Ruby library and a command line program. You can use Ruby or JSON to build the final PDF.
## Features
+- A4 and US letter paper size
- Invoice/document name and number
- Purchaser and provider boxes with addresses and identificaton numbers
- Payment method box showing banking details including SWIFT and IBAN fields
- Issue/due dates box
- Configurable items' table with item description, quantity, unit, price per unit, tax and item's total amount fields
@@ -22,10 +22,12 @@
- Configurable font file
- Logotype (as image scaled to fit 50px of height)
- Background (as image)
- Stamp & signature (as image)
- Note
+- JSON format
+- CLI
- Well tested
## Example
| Simple invoice |
@@ -142,12 +144,67 @@
}
end
end
```
+### JSON format
+
+JSON format is supported via `from_json` method. JSON itself mimicks the original Ruby objects:
+
+```ruby
+json = InvoicePrinter::Document.new(...).to_json
+document = InvoicePrinter::Document.from_json(json)
+
+
+InvoicePrinter.print(
+ document: document,
+ ...
+)
+
+```
+
+## CLI
+
+InvoicePrinter ships with a command line executable called `invoice_printer`.
+
+It supports all features except it only accepts JSON as an input.
+
+```
+$ invoice_printer --help
+Usage: invoice_printer [options]
+
+Options:
+
+ -l, --labels labels as JSON
+ -d, --document document as JSON
+ -s, --stamp path to stamp
+ --logo path to logotype
+ --font path to font
+ --page_size letter or a4 (letter is the default)
+ -f, --filename output path
+ -r, --render directly render PDF stream (filename option will be ignored)
+```
+
+
## Customization
+### Page size
+
+Both A4 and US letter is supported. Just pass `page_size` as an argument to `print` or `render` methods:
+
+```ruby
+InvoicePrinter.print(
+ document: invoice,
+ labels: labels,
+ page_size: :a4,
+ file_name: 'invoice.pdf'
+)
+```
+
+`:letter` is the default.
+
+
### Localization
To localize your documents you can set both global defaults or instance
overrides:
@@ -170,11 +227,11 @@
Here is the full list of labels to configure. You can paste and edit this block
to `initializers/invoice_printer.rb` if you are using Rails.
```ruby
InvoicePrinter.labels = {
- name: 'Invoice'
+ name: 'Invoice',
provider: 'Provider',
purchaser: 'Purchaser',
tax_id: 'Identification number',
tax_id2: 'Identification number',
payment: 'Payment',
@@ -191,10 +248,10 @@
price_per_item: 'Price per item',
amount: 'Amount',
tax: 'Tax',
tax2: 'Tax 2',
tax3: 'Tax 3',
- subtotal: 'Subtotal'
+ subtotal: 'Subtotal',
total: 'Total'
}
```
You can also use sublabels feature to provide the document in two languages: