Sha256: 803c13a5c07bfb330293b80bf3c4e32f8e2c30e73c8d871f5ba92e677ae2f51c
Contents?: true
Size: 879 Bytes
Versions: 3
Compression:
Stored size: 879 Bytes
Contents
#!/usr/bin/env ruby $LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib") require 'pdf/reader' class PageTextReceiver attr_accessor :content # Called when page parsing starts def end_page(arg = nil) if @content puts @content @content = nil puts end end def show_text(string, *params) @content = "" if @content.nil? @content << string end # there's a few text callbacks, so make sure we process them all alias :super_show_text :show_text alias :move_to_next_line_and_show_text :show_text alias :set_spacing_next_line_show_text :show_text def show_text_with_positioning(*params) params = params.first params.each { |str| show_text(str) if str.kind_of?(String)} end end receiver = PageTextReceiver.new if ARGV.empty? PDF::Reader.new.parse($stdin, receiver) else PDF::Reader.file(ARGV[0], receiver) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pdf-reader-0.7.3 | bin/pdf_text |
pdf-reader-0.7.4 | bin/pdf_text |
pdf-reader-0.7.5 | bin/pdf_text |