README in pdf-reader-0.5 vs README in pdf-reader-0.5.1

- old
+ new

@@ -24,11 +24,12 @@ images, shapes, etc) it will call methods on the receiver class. What those methods do is entirely up to you - save the text, extract images, count pages, read metadata, whatever. For a full list of the supported callback methods and a description of when they -will be called, refer to PDF::Reader::Content. +will be called, refer to PDF::Reader::Content. See the code examples below for a +way to print a list of all the callbacks generated by a file to STDOUT. = Exceptions There are two key exceptions that you will need to watch out for when processing a PDF file: @@ -70,10 +71,24 @@ end end receiver = PageReceiver.new pdf = PDF::Reader.file("somefile.pdf", receiver) - puts "#{pdf.page_count} pages" + puts "#{receiver.page_count} pages" + +== List all callbacks generated by a single PDF + +WARNING: this will generate a *lot* of output, so you probably want to pipe +it through less or to a text file. + + require 'rubygems' + require 'pdf/reader' + + receiver = PDF::Reader::RegisterReceiver.new + pdf = PDF::Reader.file("somefile.pdf", receiver) + receiver.callbacks.each do |cb| + puts cb + end == Basic RSpec of a generated PDF require 'rubygems' require 'pdf/reader'