Update pdfocr.rb



tested versions:
hocr2pdf v0.8.9
tesseract v3.03
pdfocr v0.1.4 + patch submitted of ashwin on 9th June.

sympton:
hocr2pdf seems that it can only handle a hocr file that specifies a location of each character. It seems it cannot handle a new format of hocr file that specifies a location of each word. However tesseract generates a hocr file that specifies locations of words, not characters.

Therefore a result of hocr2pdf does not contain all the texts from tesseract. When an output file of hocr2pdf opened in a pdf viewer, it looks like font sizes or locations of texts are wrong. It seems this is a bug of hocr2pdf that cannot handle word by word format of hocr.

fix:
Below code bypasses this bug and enables pdfocr to do the job without hocr2pdf by using tesseract's feature to make a sandwich pdf.