Skip to content

Commit

Permalink
correct documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
whysthatso committed Mar 5, 2024
1 parent 66bd1c2 commit b340a42
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,35 +128,37 @@ Here's an example of where each option is displayed.
![options](examples/images/options.jpg)
### Formatting
#### Line Items Table - Column Widths
`details` and `line_items` allow inline formatting with Prawn. This allows you to use HTML tags to format text: `<b>` `<i>` `<u>` `<strikethrough>` `<sub>` `<sup>` `<font>` `<color>` `<link>`
You may set an option to configure the line items table's columns width in order to accommodate shortcomings of Prawn's width guessing ability to render header and content reasonably sized.
The configuration depends on your line item column count and follows the prawn/table configuration as documented [here](https://prawnpdf.org/prawn-table-manual.pdf):
See [the Prawn docs](https://prawnpdf.org/api-docs/2.3.0/Prawn/Text.html#text-instance_method) for more information.
This will size the second column to 400 and the fourth column to 50.
#### Page Size
```ruby
column_widths: {1 => 400,3 => 50 }
```
You can specify a different page size by passing in the `page_size` keyword argument:
This will set all column widths, considering your table has 4 columns.
```ruby
receipt = Receipts::Receipt.new page_size: "A4"
column_widths: [100, 200, 240]
```
##### Line Items Table - Column Widths
If not set, it will fall back to Prawn's default behavior.

You can optionally configure the line items section's columns width in order to accommodate shortcomings of Prawn's width guessing ability to render header and content reasonably sized.
The configuration depends on your line item column count and follows the prawn/table configuration as documented [here](https://prawnpdf.org/prawn-table-manual.pdf):
### Formatting

This will size the second column to 400 and the fourth column to 50.
`details` and `line_items` allow inline formatting with Prawn. This allows you to use HTML tags to format text: `<b>` `<i>` `<u>` `<strikethrough>` `<sub>` `<sup>` `<font>` `<color>` `<link>`

```ruby
line_items: [data_array, column_widths: {1 => 400,3 => 50 }]
```
See [the Prawn docs](https://prawnpdf.org/api-docs/2.3.0/Prawn/Text.html#text-instance_method) for more information.

This will set all column widths, considering your table has 4 columns.
#### Page Size

You can specify a different page size by passing in the `page_size` keyword argument:

```ruby
line_items: [data_array, column_widths: [100, 200, 240]]
receipt = Receipts::Receipt.new page_size: "A4"
```

### Internationalization (I18n)
Expand Down

0 comments on commit b340a42

Please sign in to comment.