Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby
branch: master
Failed to load latest commit information.
ext Initial checkin
lib/pdf Without the rjb, just errors. Fixed; Using require_relative as it's q…
spec Initial checkin
.gitignore
Carrierwave.md Move Carrierwave info to its own file
Gemfile updated Gemfile and Rakefile per newest jeweler
Gemfile.lock remove rcov and regenerate Gemfile.lock
History.txt update version to 0.3.2
LICENSE.txt update copyright year
README.md Move Carrierwave info to its own file
Rakefile updated Gemfile and Rakefile per newest jeweler
VERSION
pdf-merger.gemspec Without the rjb, just errors. Fixed; Using require_relative as it's q…

README.md

PDF Merging (pdf/merger)

by Paul Schreiber

Github repo

Merge PDFs using iText.

Ruby

require "pdf/merger"
failure_list = []
pdf = PDF::Merger.new
pdf.add_file "foo.pdf"
pdf.add_file "bar.pdf"
pdf.add_javascript "this.print(true);"
pdf.save_as "combined.pdf", failure_list

Rails

Installation

# Gemfile.rb
gem 'rjb'
gem 'pdf-merger'

As always:

$ bundle install
$ rails server

Encoding

On some systems, such as Linux, you need to manually set the encoding. If you don't do that, merging on filenames with special characters will fail with a java.io.IOEXception (not found as file or resource).

I added this line to my environments/production.rb to fix the problem:

# environments/production.rb
ENV["LC_ALL"] = "en_US.utf8"

License

Copyright 2010-14 Paul Schreiber. Released under the MIT License. See LICENSE.txt for further details.

Something went wrong with that request. Please try again.