Skip to content

Instantly share code, notes, and snippets.

@backwardm
Created July 28, 2015 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save backwardm/96427244cd6cc4c37ee9 to your computer and use it in GitHub Desktop.
Save backwardm/96427244cd6cc4c37ee9 to your computer and use it in GitHub Desktop.
Counting PDF pages with pdf-reader gem
require 'rubygems'
require 'pdf-reader'
Dir.glob("/Users/mike/Desktop/zip/**/*").each do |pdf|
next if pdf == '.' or pdf == '..' or pdf == '.DS_Store'
if File.file?(pdf)
reader = PDF::Reader.new(pdf)
puts (pdf + "," + reader.page_count.to_s)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment