• Stars
    star
    196
  • Rank 198,553 (Top 4 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ruby gem that converts office documents to PDF using LibreOffice / OpenOffice.

Libreconv

Convert office documents using LibreOffice / OpenOffice to one of their supported formats.

Build Status Gem Version

Installation

Add this line to your application's Gemfile:

gem 'libreconv'

And then execute:

$ bundle

Or install it yourself as:

$ gem install libreconv

Usage

You need to install LibreOffice or OpenOffice on your system to use this gem. The code has been tested with LibreOffice 6.1.3.

require 'libreconv'

# Converts document.docx to my_document_as.pdf
# This requires that the soffice binary is present in your PATH.
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents/my_document_as.pdf')

# Converts document.docx to pdf and writes the output to the specified path
# This requires that the soffice binary is present in your PATH.
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents')

# You can also convert a source file directly from an URL
Libreconv.convert('http://myserver.com/123/document.docx', '/Users/ricn/pdf_documents/doc.pdf')

# You cal pass a URL with GET params like this S3 example
Libreconv.convert('https://mybucket.s3.amazonaws.com/myserver/123/document.docx?X-Amz-Expires=456&X-Amz-Signature=abc', '/Users/ricn/pdf_documents/doc.pdf')

# Converts document.docx to document.pdf
# If you for some reason can't have soffice in your PATH you can specify the file path to the soffice binary
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents', '/Applications/LibreOffice.app/Contents/MacOS/soffice')

# Converts document.docx to my_document_as.html
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents/my_document_as.html', nil, 'html')

# Converts document.docx to my_document_as.pdf using writer_pdf_Export filter
Libreconv.convert('document.docx', '/Users/ricn/pdf_documents/my_document_as.pdf', nil, 'pdf:writer_pdf_Export')

Development

After checking out the repo, run bundle install to install dependencies. Then, run bundle exec rake to run the tests. You can also run irb -r bundler/setup -r libreconv for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

  • Install LibreOffice on Linux: sudo apt-get install libreoffice
  • Install LibreOffice on Mac: brew cask install libreoffice
  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Contributors

The following people have contributed ideas, documentation, or code to Libreconv:

License

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

More Repositories

1

craco-antd

A craco plugin to use Ant Design with create-react-app
JavaScript
234
star
2

craco-less

A Less plugin for craco / react-scripts / create-react-app
JavaScript
123
star
3

ruby_crystal_codemod

A codemod / transpiler that can help you convert Ruby into Crystal
Ruby
43
star
4

rails_docker_example

Optimized Docker builds for Rails
Shell
19
star
5

geolite2-city-mirror

Mirror of http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
12
star
6

better_content_security_policy

A better way to configure Content-Security-Policy headers for your Rails application.
Ruby
9
star
7

craco-preact

A Preact plugin for craco / react-scripts / create-react-app
JavaScript
7
star
8

convox-git-push

"git push" deploys for convox
Shell
4
star
9

formapi-javascript

JavaScript API Client for https://formapi.io - https://www.npmjs.com/package/formapi
JavaScript
3
star
10

docspring-openapi-generator

FormAPI client libraries
HTML
2
star
11

bitcoin-puzzle-2018

Source code and solutions for the 2018 Bitcoin Puzzle / Programming Challenge
JavaScript
2
star
12

formapi-php

PHP API client for FormAPI
PHP
2
star
13

docspring-enterprise-aptible

On-premise setup instructions for Aptible
Shell
2
star
14

docspring-javascript

JavaScript API Client for DocSpring
JavaScript
2
star
15

docspring-elixir

DocSpring API client for Elixir / Phoenix applications
Elixir
1
star
16

formapi-python

Python client for FormAPI
Python
1
star
17

raven-redux-rails

Handle errors in your React/Redux app, store Redux state in an S3 bucket, send the URL to Sentry
1
star
18

openapi-generator-config-mirror

Mirror for the ./api_clients directory in the DocSpring monorepo
Mustache
1
star
19

formapi-ruby

Ruby API Client for FormAPI
Ruby
1
star
20

docspring-csharp

C# API Client for DocSpring
C#
1
star
21

convox_installer

A Ruby library that makes it easy to install Convox and set up AWS resources
Ruby
1
star