Sha256: 5a2b36ae4d1503eb69ae657f74cd35c1051b31cfb344447c3e79058bd42fc642

Contents?: true

Size: 621 Bytes

Versions: 21

Compression:

Stored size: 621 Bytes

Contents

#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__) + '/../lib'))

require 'pdf-reader'
require 'optparse'

def program_name
  File.basename(File.expand_path(__FILE__))
end

OptionParser.new do |opts|
  opts.banner = "Usage: #{program_name} [options] file"

  opts.on('-h', '--help', 'Prints this help') do
    puts opts
    exit
  end
end.parse!

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

reader.pages.each do |page|
  # written like this, and not file.write(page.text.split("\n")),
  # to behave in exactly the same way as the importer
  page.text.split("\n").each do |line|
    puts line
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ndr_import-8.5.1 exe/pdf_to_text