Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby
# encoding: UTF-8
# merge pages from two pdf documents (same as Merge Every Other)
# only the two documents to be merged must be opened, the first must be the front window.
# this assumes a feed scanner, hence expects the second document's pages to be reversed.
require 'appscript'
include Appscript
pp=app('pdfpen')
a, b, c = *pp.documents.get, pp.make(:new => :document)
a.pages.get.zip(b.pages.get.reverse).flatten.each { |p| pp.duplicate p, to:c.pages.end }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment