Project

elegant

0.0
No release in over 3 years
Low commit activity in last 3 years
Elegant expands Prawn providing a new class to generate new pages with an elegant layout.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.8.10
~> 0.2.4
~> 10.0
~> 3.3

Runtime

~> 2.0
 Project Readme

Elegant

Elegant provides a nice layout for PDF reports generated in Ruby.

The source code is available on GitHub and the documentation on RubyDoc.

Build Status Coverage Status Dependency Status Code Climate Online docs Gem Version

Elegant is a library built on top of Prawn to generate PDF files in Ruby.

Whereas Prawn creates PDF pages that are completely blank (letting users customize them at will), Elegant comes with a nice layout that makes each page look… elegant! 😉

How to use

If you have never used Prawn to generate PDF files, you should first read its manual.

Using Elegant is as simple as replacing any instance of Prawn::Document with Elegant::Document:

# with Prawn
Prawn::Document.new do
  text 'Hello, World!'
end

# with Elegant
Elegant::Document.new do
  text 'Hello, World!'
end

# with Elegant and extra options
header = {text: 'A report', logo: {url: 'http://lorempixel.com/500/500'}}
footer = {text: 'A link', url: 'http://www.example.com'}
Elegant::Document.new(header: header, footer: footer) do
  title 'Welcome'
  text 'Hello, world!'
end

Prawn vs. Elegant

Elegant::Document accepts some options [... TODO ...]

How to install

Elegant requires Ruby 2.1 or higher.

To include in your project, add gem 'elegant', ~> '1.0' to the Gemfile file of your Ruby project.

How to generate the manual

rake manual

How to contribute

If you’ve made it this far in the README… thanks! ✌️ Feel free to try it the gem, explore the code, and send issues or pull requests.

All pull requests will have to make Travis and Code Climate happy in order to be accepted. 😙

You can also run the tests locally with bundle exec rspec.

Happy hacking!