TODO: Write a gem description
Add this line to your application's Gemfile:
gem 'prawml'
And then execute:
$ bundle
Or install it yourself as:
$ gem install prawml
Describe in an yaml file the fields and its xpos, ypos and style/type options:
# example.yml
text1:
- [250, 680, {style: bold, align: center, size: 96, font: 'Helvetica'}]
- [220, 0]
text2: [415, 660, {style: italic, size: 16,align: right, color: '123456'}]
barcode1: [100, 15, {type: 'barcode', symbology: 'code_25_interleaved'}]
PDF generation example:
pdf = Prawml::PDF.new('path_to_yaml/example.yml')
pdf.generate({
:text1 => 'Prawml',
:text2 => 'The pdf generator',
:barcode1 => 'My little barcode string'
}).render_file('example.pdf')
You can also pass an object that responds to methods described in YAML file.
type
: text|image|barcode [text]color
: RGB color [00000]fixed
: A fixed text. Ignores values and renders the static text informed [false]
font
: Any Prawn supported font can be used [Times-Roman]align
: left|center|right [left]size
: float [12]style
: bold|normal|italic|bold_italic [normal]format
: Formating hooks (currency|date) [false]
symbology
: Symbologies available in barby gem seen here [nil]
- Wanderson Policarpo (http://github.com/wpolicarpo)
- Edson Júnior (http://github.com/ebfjunior)
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request