Sha256: eb6be3f1f5c608634e169ccf6156ce6faa228396731b72ea7f62bea82e2715f6

Contents?: true

Size: 412 Bytes

Versions: 17

Compression:

Stored size: 412 Bytes

Contents

#!/usr/bin/env ruby
# coding: utf-8

# A simple app to count the number of pages in a PDF File.

require 'rubygems'
require 'pdf/reader'

class PageReceiver
  attr_accessor :counter

  def initialize
    @counter = 0
  end

  # Called when page parsing ends
  def end_page
    @counter += 1
  end
end

receiver = PageReceiver.new
pdf = PDF::Reader.file("somefile.pdf", receiver)
puts "#{receiver.counter} pages"

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
pdf-reader-0.10.1 examples/page_counter_naive.rb
fireinc-pdf-reader-0.11.0 examples/page_counter_naive.rb
fireinc-pdf-reader-0.11.0.alpha examples/page_counter_naive.rb
pdf-reader-0.11.0.alpha examples/page_counter_naive.rb
pdf-reader-0.10.0 examples/page_counter_naive.rb
pdf-reader-0.9.3 examples/page_counter_naive.rb
pdf-reader-0.9.2 examples/page_counter_naive.rb
pdf-reader-0.9.1 examples/page_counter_naive.rb
pdf-reader-0.9.0 examples/page_counter_naive.rb
pdf-reader-0.8.6 examples/page_counter_naive.rb
pdf-reader-0.8.5 examples/page_counter_naive.rb
pdf-reader-0.8.4 examples/page_counter_naive.rb
pdf-reader-0.8.3 examples/page_counter_naive.rb
pdf-reader-0.8.2 examples/page_counter_naive.rb
pdf-reader-0.8.1 examples/page_counter_naive.rb
pdf-reader-0.8.0 examples/page_counter_naive.rb
pdf-reader-0.7.7 examples/page_counter_naive.rb