Project

djvu

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby interface for DjVuLibre tools.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

 Project Readme

Djvu

Gem Version Build Status Code Climate Test Coverage

Ruby interface for DjVuLibre tools.

Installation

Install DjVuLibre with this oneliner:

sudo apt-get update && sudo apt-get install checkinstall && wget http://downloads.sourceforge.net/djvu/djvulibre-3.5.27.tar.gz && tar -xvzf djvulibre-3.5.27.tar.gz && rm djvulibre-3.5.27.tar.gz && cd djvulibre-3.5.27 && sudo ./configure && sudo make && sudo checkinstall && cd ../ && sudo rm -rf djvulibre-3.5.27

If you need remove package:

sudo dpkg -r djvulibre

Add this line to your application's Gemfile:

gem 'djvu'

And then execute:

$ bundle

Or install it yourself as:

$ gem install djvu

And require:

require 'djvu'

Usage

Djvu.file('Alice_in_Wonderland.djvu').ddjvu(format: 'ppm', page: 1, output_file: '1.ppm')

Convert ppm to any image format with rmagick or minimagick:

MiniMagick::Image.open('1.ppm').format('png').write('1.png')
# Extract text layer from page to txt file
Djvu.file('Alice_in_Wonderland.djvu').djvutxt(page: 8, output_file: '1.txt')
# Extract text layer from page to variable
text = Djvu.file('Alice_in_Wonderland.djvu').djvutxt(page: 8)
dump = Djvu.file('Alice_in_Wonderland.djvu').djvudump
# Getting number of pages in djvu file
num = Djvu.file('Alice_in_Wonderland.djvu').djvused(e: 'n')

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/1v/djvu.

License

The gem is available as open source under the terms of the MIT License.