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