Created
December 4, 2013 22:32
-
-
Save J0J0/7796810 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
f = ARGV[0] || exit(1) | |
# get page count | |
n = `pdfinfo #{f} | grep Pages | cut -d":" -f2`.strip.to_i | |
# create empty page | |
`cd /tmp && convert -page A4 xc:white __blankpage.pdf` | |
# build pdftk command | |
cmd = "pdftk A=#{f} B=/tmp/__blankpage.pdf cat " | |
cmd << (0...n).map{|i| "A#{i+1} " }.join("B1 ") | |
cmd << " output #{f.chomp(".pdf")}_with_blanks.pdf" | |
puts cmd | |
system(cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment