How do you combine PDFs in ruby?
I wrote a ruby gem to do this — PDF::Merger. It uses iText. Here's how you use it:
pdf = PDF::Merger.new
pdf.add_file "foo.pdf"
pdf.add_file "bar.pdf"
pdf.save_as "combined.pdf"
Is it possible to combine a series of PDFs into one using Ruby?
A Ruby-Talk post suggests using the pdftk toolkit to merge the PDFs.
It should be relatively straightforward to call pdftk as an external process and have it handle the merging. PDF::Writer may be overkill because all you're looking to accomplish is a simple append.
combine_pdf not combining the pdfs
It looks like the README for that library calls .to_pdf when sending the data. Hopefully calling #to_pdf on the pdf object like in the example will fix your issue.
send_data pdf.to_pdf, filename: “my_combined_pdf”, type: "application/pdf"
https://github.com/boazsegev/combine_pdf#rendering-pdf-data
Related Topics
Heroku: How to Push Seeds.Rb to Existing Rails App
Resetting a Singleton Instance in Ruby
In Ruby, How to Read Data Column Wise from a CSV File
Spork 0.9.2 and Rspec 3.0.0 = Uninitialized Constant Rspec::Core::Commandline (Nameerror)
Collectionproxy VS Associationrelation
Vi Input Mode in Command Line Matlab
What Is the Community-Preferred Ruby Unit Testing Framework
Deleting a Hash from Array of Hashes in Ruby
Differencebetween "Be_True" and "Be True" in Rspec
Rails/Rspec: How to Test #Initialize Method
Installing a Gem from Github with Bundler
Rails: How to Get a File Extension/Postfix Based on the Mime Type
<Rubygems> How to Change Gem Environment Settings
How to Sort by Multiple Conditions with Different Orders