Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hamajyotan/librepdf
This software changes a document into PDF by Libreoffice assistance under JRuby.
https://github.com/hamajyotan/librepdf
Last synced: 4 months ago
JSON representation
This software changes a document into PDF by Libreoffice assistance under JRuby.
- Host: GitHub
- URL: https://github.com/hamajyotan/librepdf
- Owner: hamajyotan
- License: mit
- Created: 2012-04-03T03:28:29.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-04-03T08:58:10.000Z (almost 13 years ago)
- Last Synced: 2024-09-17T01:53:48.995Z (4 months ago)
- Language: Java
- Homepage:
- Size: 1.61 MB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# Librepdf
This software changes a document into PDF by Libreoffice assistance under JRuby.
## Installation
Add this line to your application's Gemfile:
gem 'librepdf'
And then execute:
$ bundle
Or install it yourself as:
$ gem install librepdf
## Set before use
### Start libreoffice as a service without GUI.
$ /opt/libreoffice3.5/program/soffice.bin \
--accept="socket,host=127.0.0.1,port=8100,tcpNoDelay=1;urp;" \
--headless \
--invisible \
--nodefault \
--nofirststartwizard \
--nolockcheck \
--nologo \
--norestore \
&### When multiinstance, required change user profile location.
$ /opt/libreoffice3.5/program/soffice.bin \
--accept="socket,host=127.0.0.1,port=8100,tcpNoDelay=1;urp;" \
--headless \
--invisible \
--nodefault \
--nofirststartwizard \
--nolockcheck \
--nologo \
--norestore \
-env:UserInstallation=file:///home/foo/.libreoffice/3 \
&## Usage
### Simple example
require 'librepdf'
con = Librepdf::Connection.new 'host' => '127.0.0.1', 'port' => 8100
doc = con.load 'file:///foo/bar/baz.doc'
doc.convert_pdf 'file:///foo/bar/baz.pdf'
doc.close
con.close### Safety usage
require 'librepdf'
Librepdf::Connection.new('host' => '127.0.0.1', 'port' => 8100) { |con|
con.load('file:///foo/bar/baz.doc') { |doc|
doc.convert_pdf 'file:///foo/bar/baz.pdf'
}
}### Password file
require 'librepdf'
Librepdf::Connection.new('host' => '127.0.0.1', 'port' => 8100) { |con|
con.load('file:///foo/bar/baz.doc', 'Password' => '@SecretP@ssW0rd') { |doc|
doc.convert_pdf 'file:///foo/bar/baz.pdf'
}
}### Pickup page
require 'librepdf'
Librepdf::Connection.new('host' => '127.0.0.1', 'port' => 8100) { |con|
con.load('file:///foo/bar/baz.doc') { |doc|
doc.convert_pdf 'file:///foo/bar/baz1.pdf', 'FilterData' => { 'PageRange' => '1-1' }
doc.convert_pdf 'file:///foo/bar/baz2.pdf', 'FilterData' => { 'PageRange' => '2-2' }
doc.convert_pdf 'file:///foo/bar/baz3.pdf', 'FilterData' => { 'PageRange' => '3-3' }
}
}## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Added some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request