Gjman is a handyman with some useful tools
Ruby Java Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


GJMAN is a handyman with some useful tools

Gjman is my neighbourhood friendly handyman with some useful tools. Tools available will remain diverse, and are added as and when i need them.

Getting Started

It's hosted on gemcutter.org.

$ sudo gem install gjman

Under the hood, gjman uses some java libs, u can either run it using:

  • jruby, or

  • any rubies with rjb installed, or

  • any rubies, as long as java can be found in $PATH

PDF Tools

1. Merging (2 or more pdfs)

require 'gjman/pdf'
Gjman::PDF.merge('/path/to/pdf1', '/path/to/pdf2', '/path/to/pdf3')
# >> merges the 3 pdfs & return the merged pdf path

Gjman::PDF.merge('/path/to/pdf1', '/path/to/pdf2', :to => '/path/to/merged/pdf')
# >> merges the pdfs & return the merged pdf path, which is '/path/to/merged/pdf'

2. Testing if 2 pdfs have the same content

require 'gjman/pdf'
Gjman::PDF.match?('/path/to/pdf1', '/path/to/pdf2')
# >> true/false if the 2 pdfs have same/different content


  • textual comparison takes into account wordings, positioning, sizes, fonts, colors, backgrounds & styles (bold, italic, etc)

  • image comparison takes into account positioning, size, & byte length (if 2 images share the same byte length, they are taken to be the same)

3. Compressing/uncompressing a pdf

require 'gjman/pdf'
# >> compresses pdf & returns the compressed pdf path

Gjman::PDF.compress('/path/to/pdf', :to => '/path/to/compressed/pdf')
# >> compresses pdf to /path/to/compressed/pdf & returns it

The above applies to uncompression as well.

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.


Copyright © 2010 ngty77[at]gmailcom. See LICENSE for details.