Why texts are jumbled using PDF-reader

I am using pdf-reader gem and trying to look for some content at some
particular position on PDF. So what I am doing…

require ‘rubygems’
require ‘pdf-reader’
reader = PDF::Reader.new(“general.pdf”)
page1=reader.page(1)
page1_txt=page1.to_s

In page1_txt I can see that Words or the blanks in PDF which is filled,
are not in the order we expect looking at PDF. Why this happens? and how
to take care of that, So I can be definite to say that s1 string can
only be searched between s2 and s3.

any other better gem to look for string in particular position in pdf?

I can’t even find that one :frowning:

C:\Users\test\Desktop>gem install pdf-reader
ERROR: Could not find a valid gem ‘pdf-reader’ (>= 0) in any repository
ERROR: Possible alternatives: pdf-reader

Joel P. wrote in post #1084721:

I can’t even find that one :frowning:

C:\Users\test\Desktop>gem install pdf-reader
ERROR: Could not find a valid gem ‘pdf-reader’ (>= 0) in any repository
ERROR: Possible alternatives: pdf-reader

http://www.ruby-forum.com/topic/430160
OR
https://www.google.co.in/search?client=ubuntu&channel=fs&q=could+not+find+valid+gem&ie=utf-8&oe=utf-8&redir_esc=&ei=RrWmUL2tHsLwrQeCxoCYCA

any idea? why it happens? or any solution?