Search code examples
ruby-on-railsprawn

Prawn - Rails 5.2 Put two bits of text on the same line but at either side


I've been trying to replicate the text style in the following example:

text format example

But I havn't been able to find a way to put two text elements on the same line.

Is this possible with Prawn? If so how does one do it?


Solution

  • You can use prawn-table, your image looks like a table with 2 columns.

    https://github.com/prawnpdf/prawn-table

    table([
      ["Base Price", "$275,99],
      ["Canary Cozy Sound Isolation Blankey", "$11.00"]
    ])
    

    You will have to play, of course, with the style of the table to remove borders, the alignment of the cells for the second column, etc.