Ebookie
Generate PDF, ePub, and Mobi eBooks
Installation
Add this line to your application's Gemfile:
gem 'ebookie'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ebookie
Usage
Create a new document:
document = Ebookie::Document.new "My eBook" # Title
Configure it:
document.configure do |config|
config.cover = './path/to/cover.png' # Cover image
config.destination = './ebook/' # Ouput for ePub, Mobi, PDF
config.subject = "Introductions"
config.source = "http://google.com"
end
Add a chapter:
# You can pass a string for the content
document.chapter 'Getting Started', "All about how to get started"
# You can also give it an html file to read
document.chapter 'Getting Started', Pathname.new("path/to/myfile.html")
Add an image:
# Relative or absolute path for image to be copied
document.image './path/to/image.png'
# Chapters can reference images with html:
document.chapter "My Cool Image", "<img src='image.png' alt='image' />"
Render the document:
# ePub
document.render_epub
# Mobi
document.render_mobi
# PDF
document.render_pdf
Install templates for customization:
$ ebookie install ./path/to/templatees
Then configure the document:
document.config.template = './path/to/templates'
Contributing
- Fork it ( http://github.com/jordanandree/ebookie/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request