#!/usr/bin/env ruby

# text extraction is a handy benchmark of parsing/lexing performance, as 
# the full content stream of each page is processed.
#
# run like so:
#
#     ruby -Ilib tools/page_bench foo.pdf

require 'rubygems'
require 'pdf/reader'

reader = PDF::Reader.new(ARGV[0])

require "benchmark"

Benchmark.bm(1) do |x|
  reader.pages.each do |page|
    x.report(page.number) { page.text }
  end
end
