Merging Pdf’s in Rails application

bob-roberts.net

Alright, I had a lot of fun today trying to figure out how to merge pdf’s in our Rails application.

We are using pdfkit to create our pdf’s.  What I needed to do was to take several pdf’s and merge them into one large pdf.  Frankly I did not think it was even possible.  I found several Ruby gems that were supposed to do the job but everyone I tried was just another PITA dead end.

After getting pointed in the right direction by @m3talsmith, I ended up solving my issue the old school way.  So, if you have done this before with Ruby gems stick with it.  If not, here we go…

I first started with an empty array for pdfs.  Then I went thru a couple of processes to add all the pdfs to the pdfs array.

After that, comes the old school.  Using Ghostscript (gs) we joined…

View original post 57 more words

Advertisements