Skip to content

Instantly share code, notes, and snippets.

@rush2sk8
Last active August 16, 2019 18:54
Show Gist options
  • Save rush2sk8/dfbf73c45242f0d17e3194c411956abe to your computer and use it in GitHub Desktop.
Save rush2sk8/dfbf73c45242f0d17e3194c411956abe to your computer and use it in GitHub Desktop.
require 'pdf-reader'
wordsToFind = ARGV
Dir.entries(".").select { |f| File.file?(File.join(".", f)) && File.extname(f) == ".pdf"}.each { |file|
puts file
pReader = PDF::Reader.new(file)
pReader.pages.each_with_index { |page, idx|
wordsToFind.each {|keyword|
if page.text.include? keyword
puts "pg: #{idx+1} has keyword: #{keyword}"
end
}
}
}
@PaoloLami
Copy link

gay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment