Generating new PDF from two existing PDFS

34 views
Skip to first unread message

Ben Petro

unread,
Apr 10, 2012, 6:20:33 PM4/10/12
to Prawn
I have two documents, the first is a multiple page portrait A4 PDF,
and the second is a single page landscape A3 PDF, and I want to add
the A3 page to the bottom of the A4 pages, then save them as a new
single PDF, so when someone prints the new document, the entire thing
prints.

FYI, the reason I'm doing this is the printer is designed to staple
the entire document when complete.

Is this possible in Prawn and if so, how would I do it. I need to be
able to create a new pdf, then load the existing PDFs into it and save
the new one.

Brad Ediger

unread,
Apr 10, 2012, 8:10:40 PM4/10/12
to prawn...@googlegroups.com

You might be able to hack this together using Prawn's template
support, but if you are able to install software and shell out from
Ruby, typically the path of least resistance is to shell out to pdftk:

pdftk file1.pdf file2.pdf cat output result.pdf

-be

Reply all
Reply to author
Forward
0 new messages