Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/antoinelyset/poleica
Poleica : Ruby conversion tool & preview creator
https://github.com/antoinelyset/poleica
conversion documents gif image jpeg libreoffice pdf png preview ruby
Last synced: 29 days ago
JSON representation
Poleica : Ruby conversion tool & preview creator
- Host: GitHub
- URL: https://github.com/antoinelyset/poleica
- Owner: antoinelyset
- License: mit
- Created: 2013-06-14T17:41:19.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-03-18T14:50:15.000Z (almost 10 years ago)
- Last Synced: 2024-04-25T20:02:51.163Z (10 months ago)
- Topics: conversion, documents, gif, image, jpeg, libreoffice, pdf, png, preview, ruby
- Language: Ruby
- Homepage:
- Size: 636 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Poleica
## Ruby conversion tool & preview creator[](https://travis-ci.org/antoinelyset/poleica)
[](https://coveralls.io/r/antoinelyset/poleica)
[](https://codeclimate.com/github/antoinelyset/poleica)
[](http://badge.fury.io/rb/poleica)
[](https://gemnasium.com/antoinelyset/poleica)## Concept
_ -> PDF -> Image
Image -> Image
Basically it just takes some files, tries to convert it to PDF or PNG. It was modularly written, so you can improve the gem with more conversion tools (html to pdf is planned).
## Installation
__Ubuntu__ :
Look at [.travis.yml](https://github.com/antoinelyset/poleica/blob/master/.travis.yml) file
__MacOS__ :
```
brew install ghostscript graphicsmagick
```
Download [LibreOffice](http://www.libreoffice.org/download) and install it.__Then__ :
```
gem install poleica
```or in __Gemfile__ :
```ruby
gem 'poleica'
```## Usage
```ruby
Poleica.new(file_path).to_png
Poleica.new(file_path).to_pdf
Poleica.new(file_path).to_thumbnail
Poleica.new(file_path).to_png(width: 400, weight: 400)
```## Configuration
Example :
```ruby
Poleica.configure do |config|
config.timeout = 2 # time in secs
config.libre_office[:bin_paths][:linux] = '/usr/local/bin/gm'
config.graphics_magick[:bin_paths][:osx] = '/Applications/OpenOffice.app/Contents/MacOS/soffice.bin'
end
```## Options
- weight : pixels number
- width : pixels number
- force_resize : boolean(false) (it doesnt preserve the image ratio)
- path : string folder or file
- auto_orient : boolean(true) (keep the orientation extracted from EXIF)## Dependencies
- GraphicsMagick (gm) >= 1.3.18 (for auto-rotate)
- LibreOffice## Requirements
- It should be easy
- It should work on MacOS & Linux
- It should handle standard files
- It should convert to PNG or PDF## Standard files
- Documents: PDF, PPT, DOC, TXT..
- Images: PNG, JPEG, GIF...## Conventions
- I wrote mimetype not mime_type
## Warning
- If you want to disable .~lock.#{file_name}# creation in /tmp just :
```export SAL_ENABLE_FILE_LOCKING=0```
- Exit LibreOffice App before tests and launch## Thanks
- A lot of inspiration from a lot of gems :
- Docsplit
- Paperclip
- ROM
- ...## License
Poleica is released under the [MIT
License](http://www.opensource.org/licenses/MIT)## Trivia
Poleica = Polaroid + Leica (hipsterism)