GithubHelp home page GithubHelp logo

azendoo / poleica Goto Github PK

View Code? Open in Web Editor NEW

This project forked from antoinelyset/poleica

0.0 2.0 0.0 651 KB

Poleica : Ruby conversion tool & preview creator

License: MIT License

Ruby 100.00%

poleica's Introduction

Poleica

Ruby conversion tool & preview creator

Build Status Coverage Status Code Climate Gem Version Dependency Status

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 file

MacOS :

brew install ghostscript graphicsmagick

Download LibreOffice and install it.

Then :

gem install poleica

or in Gemfile :

gem 'poleica'

Usage

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 :

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

Trivia

Poleica = Polaroid + Leica (hipsterism)

poleica's People

Contributors

antoinelyset avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.